MySQL DATEDIFF() Function
Example
Return the number of days between two date values:
SELECT DATEDIFF("2017-06-25", "2017-06-15");
Try it Yourself »
Definition and Usage
The DATEDIFF() function returns the number of days between two date values.
Syntax
DATEDIFF(date1, date2)
Parameter Values
Parameter | Description |
---|---|
date1, date2 | Required. Two dates to calculate the number of days between. (date1 - date2) |
Technical Details
Works in: | From MySQL 4.0 |
---|
More Examples
Example
Return the number of days between two date values:
SELECT DATEDIFF("2017-06-25 09:34:21", "2017-06-15 15:25:35");
Try it Yourself »
Example
Return the number of days between two date values:
SELECT DATEDIFF("2017-01-01",
"2016-12-24");
Try it Yourself »