VeloDB Cloud
SQL Manual
Functions
date-time-functions
months_diff

months_diff

Description

Syntax:

INT months_diff(DATETIME enddate, DATETIME startdate)

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

Example

mysql> select months_diff('2020-12-25','2020-10-25');
+-----------------------------------------------------------+
| months_diff('2020-12-25 00:00:00', '2020-10-25 00:00:00') |
+-----------------------------------------------------------+
|                                                         2 |
+-----------------------------------------------------------+

Keywords

months_diff