Purpose
ADD_MONTHS() returns the value of date plus n months.
Note
Different months have different numbers of days, so if the value of date is the last day of a month, the function returns the last day of the resulting month. For example, ADD_MONTHS returns February 29, 2020 for the date one month before March 31, 2020.
Syntax
ADD_MONTHS(date, n)
Parameters
| Parameter | Description |
|---|---|
| date | A date. The parameter is of the DATE data type. |
| n | An integer or any value that can be implicitly converted to an integer. It is of the NUMBER data type.
|
Return type
The return type is DATE.
Examples
The following example returns the dates three months before and after the current date.
obclient> SELECT ADD_MONTHS(SYSDATE,-3),SYSDATE, ADD_MONTHS(SYSDATE,3) FROM DUAL;
+------------------------+-----------+-----------------------+
| ADD_MONTHS(SYSDATE,-3) | SYSDATE | ADD_MONTHS(SYSDATE,3) |
+------------------------+-----------+-----------------------+
| 17-AUG-21 | 17-NOV-21 | 17-FEB-22 |
+------------------------+-----------+-----------------------+
1 row in set