MySQL DATEDIFF() function returns the number of days between two dates. The syntax of this function is as follows -
DATEDIFF(date1,date2)
For example, if we want to know the number of days between "2017-10-22" and "2017-09-21", then we can use the DATEDIFF() function as follows Show-
mysql> Select DATEDIFF('2017-10-22','2017-09-21') AS 'NUMBER OF DAYS'; +----------------+ | NUMBER OF DAYS | +----------------+ | 31 | +----------------+ 1 row in set (0.00 sec)
The above is the detailed content of How does the MySQL DATEDIFF() function work?. For more information, please follow other related articles on the PHP Chinese website!