DATEDIFF

2025-11-19 10:08:12  Updated

Syntax

DATEDIFF(date1, date2)

Purpose

DATEDIFF() returns the number of months between date1 and date2.

Only the date part of the parameter is used in the calculation. The time part is ignored.

Examples

obclient> SELECT DATEDIFF('2015-06-19','1994-12-17');
+-------------------------------------+
| DATEDIFF('2015-06-19','1994-12-17') |
+-------------------------------------+
|                                7489 |
+-------------------------------------+
1 row in set

Contact Us