Two date functions included in MySQL are DATEDIFF()
and TIMEDIFF()
.
Both functions do a similar thing, but with some meaningful differences.
The following table summarizes the difference between these two functions:
DATEDIFF() |
TIMEDIFF() |
---|---|
Result is expressed as a value in days. | Result is expressed as a time value. |
Compares only the date value of its arguments. | Compares the time value of its arguments. |
Accepts date or date-and-time expressions. | Accepts time or date-and-time expressions. |
Both arguments can be of a different type (date or date-and-time). | Both arguments must be the same type (either time or date-and-time). |