DATEDIFF() FUNCTION in MySQL

DATEDIFF() FUNCTION
The MySQL DATEDIFF function is used to get the difference in days between two date values. The various versions of MySQL supports the DATEDIFF function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0 and MySQL 4.1.1.

Syntax:

DATEDIFF( date1, date2 )

Parameters:
date1, date2: They are used to specify the date values to be used for calculation.

Example 1:

mysql> SELECT DATEDIFF ('2019-07-07', '2019-07-05');

Output:

2

Explanation:
The difference in days of the two date values has been returned.

Example 2:

mysql> SELECT DATEDIFF ('2019-07-07 15:30:20', '2019-07-05');

Output:

2

Explanation:
The difference in days of the two date values has been returned.

Please Share