What is the equivalent date function in postgreSQL for add_months or DateAdd

I am looking for the syntax for the date function that works like dateadd in sql server that I can use in PostgreSQL.

Who is Participating?
earth man2Connect With a Mentor Commented:
date_col + term_col * interval '1 months'
You could use the overloaded arithmetic in PostgreSQL to achieve the same result. For example if you wanted to add one day to a given date you would do something similar to the code below.

Read http://www.postgresql.org/docs/8.2/interactive/functions-datetime.html for more info.

date '2007-12-06' + interval '1 day'

Open in new window

Brian_SutherlandAuthor Commented:
Thanks, what if I had a column called term that held  the number of months I want to add?
Would it be:
<date filed> + interval '<term> months'  

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.