Skip to content

Instantly share code, notes, and snippets.

@italoveloso
Created January 2, 2014 12:32
Show Gist options
  • Save italoveloso/8218567 to your computer and use it in GitHub Desktop.
Save italoveloso/8218567 to your computer and use it in GitHub Desktop.
Diff between dates - MySQL
TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)
Returns datetime_expr2 – datetime_expr1, where datetime_expr1 and datetime_expr2 are date or datetime expressions. One expression may be a date and the other a datetime; a date value is treated as a datetime having the time part '00:00:00' where necessary. The unit for the result (an integer) is given by the unit argument.
The unit argument can be: MICROSECOND (microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment