MySQL DATEDIFF () function
Definition and Usage
DATEDIFF () function returns the number of days between two dates.
grammar
DATEDIFF(date1,date2)
date1 and date2 argument are legitimate date or date / time expression.
Note: Only thedate part of the value involved in the calculation.
Examples
Here is the SELECT statement:
SELECT DATEDIFF('2008-11-30','2008-11-29') AS DiffDate
The results are as follows:
DiffDate |
---|
1 |
Examples
Here is the SELECT statement:
SELECT DATEDIFF('2008-11-29','2008-11-30') AS DiffDate
The results are as follows:
DiffDate |
---|
-1 |
MySQL Date Functions