dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


advertisement
 

Tip: Add Months to a Date in Oracle SQL

Learn to easily add a number of months to a date in Oracle SQL with the ADD_MONTHS function.


advertisement

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


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;

 

Visit the DevX Tip Bank

 



   
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date