Syntax
TIMESTAMPDIFF(unit, date1, date2)
Purpose
TIMESTAMPDIFF() returns the interval between two date and time values in the unit specified for unit. unit can only be an independent unit in DATE_ADD().
Examples
obclient> 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'): -231677498
TIMESTAMPDIFF(DAY, '2011-01-01 11:11:11', NOW()): 2681
1 row in set