Skip to main content
Returns the day difference between two date expressions (expr1 − expr2), accurate to the day. Difference between days_diff and datediff:

Syntax

Parameters

  • expr1: the end time. It must be of the DATETIME or DATE type.
  • expr2: the start time. It must be of the DATETIME or DATE type.

Return value

Returns a BIGINT value. NULL is returned if the date does not exist, for example, 2022-02-29. days_diff() takes the hour, minute, and second parts into calculation. If the difference is less than 1 day, 0 is returned.

Examples