Syntax: add_months(p_date, integer) return date;
Add_months function adds amt months to p_date date.
SELECT add_months(date'2015-01-12', 2) m FROM dual;
M |
---|
2015-03-12 |
You can also substract months using a negative amt
SELECT add_months(date'2015-01-12', -2) m FROM dual;
M |
---|
2014-11-12 |
When the calculated month has fewer days as the given date, the last day of the calculated month will be returned.
SELECT to_char( add_months(date'2015-01-31', 1),'YYYY-MM-DD') m FROM dual;
M |
---|
2015-02-28 |