May 2005
Intermediate to advanced
352 pages
14h 39m
English
TIMEDIFF( )
TIMEDIFF(time,time)
This function returns the time difference between the two times given. Although the arguments may be given in time or date-and-time format, both arguments must be of the same datatype. This function is available as of Version 4.1.1 of MySQL.
SELECT appointment AS Appointment, NOW( ) AS Now,
TIMEDIFF(appointment, NOW( )) AS 'Time Remaining'
FROM appointments
WHERE rec_id='3783';
+--------------------+--------------------+----------------+
| Appointment | Now | Time Remaining |
+--------------------+--------------------+----------------+
| 2005-01-11 10:30:00| 2005-01-11 22:28:09| 12:01:51 |
+--------------------+--------------------+----------------+Read now
Unlock full access