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
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
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