VeloDB Cloud
SQL Manual
Functions
date-time-functions
months_add

months_add

Description

Syntax:

DATETIME MONTHS_ADD(DATETIME date, INT months)

This function adds the specified months to the given date.

date can be of DATE or DATETIME type, and the returned result is of the same type as date.

Example

mysql> select months_add("2020-01-31 02:02:02", 1);
+--------------------------------------+
| months_add('2020-01-31 02:02:02', 1) |
+--------------------------------------+
| 2020-02-29 02:02:02                  |
+--------------------------------------+

Keywords

MONTHS_ADD