> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# months_add

> Adds a specified number of months to the date, accurate to the month.

Adds a specified number of months to the date, accurate to the month.

The [add\_months](/documents/4.2/sql-reference/sql-functions/date-time-functions/add_months.md) function provides similar functionalities.

## Syntax

```Haskell theme={null}
DATETIME months_add(DATETIME expr1, INT expr2);
```

## Parameters

* `expr1`: the start time. It must be of the DATETIME or DATE type.

* `expr2`: the months to add. It must be of the INT type. It can be greater, equal, or less than zero. A negative value subtracts months from `date`.

## Return value

Returns a DATETIME value.

## Examples

```Plain theme={null}
select months_add('2019-08-01 13:21:03', 8);
+--------------------------------------+
| months_add('2019-08-01 13:21:03', 8) |
+--------------------------------------+
| 2020-04-01 13:21:03                  |
+--------------------------------------+

select months_add('2019-08-01', 8);
+-----------------------------+
| months_add('2019-08-01', 8) |
+-----------------------------+
| 2020-04-01 00:00:00         |
+-----------------------------+

select months_add('2019-08-01 13:21:03', -8);
+---------------------------------------+
| months_add('2019-08-01 13:21:03', -8) |
+---------------------------------------+
| 2018-12-01 13:21:03                   |
+---------------------------------------+

select months_add('2019-02-28 13:21:03', 1);
+--------------------------------------+
| months_add('2019-02-28 13:21:03', 1) |
+--------------------------------------+
| 2019-03-28 13:21:03                  |
+--------------------------------------+

select months_add('2019-01-30 13:21:03', 1);
+--------------------------------------+
| months_add('2019-01-30 13:21:03', 1) |
+--------------------------------------+
| 2019-02-28 13:21:03                  |
+--------------------------------------+
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.