Oracle Database Working with Dates Add_months function

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

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


Got any Oracle Database Question?