-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
  • 26,923
  • 21
  • 73
  • 125

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,198,228
  • 53
  • 572
  • 709