Skip to main content

years_diff

years_diff

Description

Syntax:

INT years_diff(DATETIME enddate, DATETIME startdate)

This function calculates the number of years between the startdate and the enddate.

Example

mysql> select years_diff('2020-12-25','2019-10-25');
+----------------------------------------------------------+
| years_diff('2020-12-25 00:00:00', '2019-10-25 00:00:00') |
+----------------------------------------------------------+
| 1 |
+----------------------------------------------------------+

Keywords

years_diff