Name
TIMEDIFF( )
Synopsis
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 | +--------------------+--------------------+----------------+
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.