ADD_MONTHS

Purpose

This function adds a specified number of months to a date or timestamp.

Syntax

add_months::=

Add Months

Usage Notes

  • Decimals are rounded before adding that number.
  • If the resulting month has fewer days than the day of the date of entry, the last day of the month is returned.
  • If the input date is the last day of a month, then the last day of the resulting month is returned.
  • For data type TIMESTAMP WITH LOCAL TIME ZONE this function is calculated within the session time zone.

Example

SELECT ADD_MONTHS(DATE '2006-01-31', 1) AM1,
       ADD_MONTHS(TIMESTAMP '2006-01-31 12:00:00', 2) AM2;
Result
AM1 AM2
2006-02-2 2006-03-31 12:00:00.000000