By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

problem with date

100+
P: 138
hi all,
how can i add some months in the current date in postgres.
ie
select current_date +1;
this query returns tomorrow's date. and similary +2 gives the day after tomorrow's date.
but what if we want to add 3 months in the current date, ie. 19 june, 2007 so that it returns the date of 19,September 2007 or what if we want to add some year in it.
can u please give me any query or code to do this.
i am using postgres 8.0
thanx in advance
Jun 19 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 534
This should work for you:
Expand|Select|Wrap|Line Numbers
  1. select current_date + interval '3 month';
  2. select current_date + interval '1 year';
  3.  
Follow these links for more information on date/time functions
http://www.postgresql.org/docs/8.0/s...-datetime.html
http://www.postgresql.org/docs/8.0/s...-datetime.html
Jun 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.