-3

I want to retrieve a time from Mysql table and want to get it's difference with current time time.

To be More clear :

[Current_Time]-[Time retrieved from SQL TABLE] = HH:MM:SS

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

You can do the calculation in the database. For instance, if the "time column" is stored as datetime:

select timediff(now(), t.timecol)
from table

If the timecol is stored as a time data type, then use:

select timediff(curtime(), t.timecol)
from table
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786