This tutorial explains how to use the MySQL DATEDIFF function with syntax and examples.
The MySQL DATEDIFF function returns the difference in days between two date values.
The syntax for the DATEDIFF function in MySQL is:
The two dates to calculate the difference between. The calculation is date1 - date2.
The DATEDIFF function can be used in the following versions of MySQL:
Let's look at some MySQL DATEDIFF function examples and explore how to use the DATEDIFF function in MySQL.
For example:
This last DATEDIFF example would display the difference between current system date and '2014-02-14' (current system date is returned by the CURDATE function).