devxlogo

Add Months to a Date in Oracle SQL

Add Months to a Date in Oracle SQL

If you ever want to add a number of months to a date in Oracle SQL, you can use the ADD_MONTHS function. It’s a simple function and takes two parameters???a date and the number of months.

To add 3 months to today’s date:

SELECT ADD_MONTHS(SYSDATE, 3) FROM dual;

To add 12 months to a hire_date column:

SELECT ADD_MONTHS(hire_date, 12)FROM employee;

You can also subtract months by supplying a negative number. To subtract 6 months from a hire date column:

SELECT ADD_MONTHS(hire_date, -6)FROM employee;
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist