Format: add_months (Date,number) that is add_months (date, number)
The Add_months function returns a new date by adding a specified number of months to the input date. If a negative number is given, the date of the month before the duty period is returned.
Number in add_months (Date,number) should be an integer, given a decimal, positive numbers are truncated to the largest integer less than that number, and negative numbers are truncated to the smallest integer greater than that number.
Example: Add_months (to_date (' 29-feb-96 ', ' d-mon-yyyy '),-12.99) back to 28-feb-95
Note: The previous example in 29 was adjusted to 28 because the last day of February 96 was 29th, and the last day in February 95 was 28th.
Add_months (to_date (' 15-nov-1961 ', ' d-mon-yyyy '), 1) back to 15-dec-1961
Add_months (to_date (' 30-nov-1961 ', ' d-mon-yyyy '), 1) back to 31-dec-1961
Note: Adjust from 30 to 31, in order to keep all the corresponding last day.
Add_months (to_date (' 31-jan-1999 ', ' d-mon-yyyy '), 1) back to 28-feb-1999
Note: The function will be 31st to 28th to make the result pair downsizing the last day of January, since February 1999 is only 28 days.
ORACLE Date Function Add_months