TIMESTAMPDIFF
Declaration
TIMESTAMPDIFF(unit, date1, date2)
Description
Returns the interval between two date and time values in the specified unit. The unit parameter can only be one of the units supported by the DATE_ADD function.
Examples
SELECT
TIMESTAMPDIFF(SECOND, NOW(), '2011-01-01 11:11:11'),
TIMESTAMPDIFF(DAY, '2011-01-01 11:11:11', NOW())
\G
*************************** 1. row ***************************
TIMESTAMPDIFF(SECOND, NOW(), '2011-01-01 11:11:11'): -472114117
TIMESTAMPDIFF(DAY, '2011-01-01 11:11:11', NOW()): 5464
1 row in set (0.001 sec)