mysql calculates the time difference function


MySql calculates the time difference between two dates Grammar: TIMESTAMPDIFF(interval,datetime_expr1,datetime_expr2) Description: Returns the integer difference between the date or date-time expressions datetime_expr1 and datetime_expr2the. As a result of The units are given by the interval parameter. The legal value of interval is the same as listed in the TIMESTAMPADD() function description.

SELECT TIMESTAMPDIFF(MONTH,'2009-10-01','2009-09-01');
interval But:
SECOND  seconds  SECONDS
MINUTE  minutes  MINUTES
HOUR  time  HOURS
DAY  day  DAYS
MONTH  month  MONTHS
YEAR  years  YEARS