Thread
-
Date question
Boulat Khakimov <boulat@inet-interactif.com> — 2001-03-06T19:19:59Z
Hi, Im a little bit stuck here. Does anyone know how to get date in format 'YYYY-MM-DD' of a date one year from now. So for example today is '2001-03-06' I need to get date 12 months from now which will be '2002-03-06' in todays case... In mysql I used DATE_ADD(CURDATE(), INTERVAL 12 MONTH) , but that doesnt work in PG. Regards, Boulat Khakimov -- Nothing Like the Sun
-
Re: [SQL] Date question
Michael Fork <mfork@toledolink.com> — 2001-03-06T19:26:58Z
This will do it: mfork=# SELECT to_char(now() + '1 Year'::interval, 'YYYY-MM-DD'); to_char ------------ 2002-03-06 (1 row) Michael Fork - CCNA - MCP - A+ Network Support - Toledo Internet Access - Toledo Ohio On Tue, 6 Mar 2001, Boulat Khakimov wrote: > Hi, > > Im a little bit stuck here. > > Does anyone know how to get date in format 'YYYY-MM-DD' of a date one > year from now. > So for example today is '2001-03-06' I need to get date 12 months from > now > which will be '2002-03-06' in todays case... > > In mysql I used DATE_ADD(CURDATE(), INTERVAL 12 MONTH) , but that > doesnt work in PG. > > > Regards, > Boulat Khakimov > > > -- > Nothing Like the Sun >
-
RE: [SQL] Date question
Francis Solomon <francis@stellison.co.uk> — 2001-03-06T19:30:03Z
Hi Boulat, stasis=# select (now() + '1 year')::date; ?column? ------------ 2002-03-06 (1 row) Hope this helps Francis > Hi, > > Im a little bit stuck here. > > Does anyone know how to get date in format 'YYYY-MM-DD' of a date one > year from now. > So for example today is '2001-03-06' I need to get date 12 months from > now > which will be '2002-03-06' in todays case... > > In mysql I used DATE_ADD(CURDATE(), INTERVAL 12 MONTH) , but that > doesnt work in PG. > > > Regards, > Boulat Khakimov
-
Re: Date question
Peter Eisentraut <peter_e@gmx.net> — 2001-03-06T19:40:25Z
Boulat Khakimov writes: > Does anyone know how to get date in format 'YYYY-MM-DD' of a date one > year from now. > So for example today is '2001-03-06' I need to get date 12 months from > now > which will be '2002-03-06' in todays case... > > In mysql I used DATE_ADD(CURDATE(), INTERVAL 12 MONTH) , but that > doesnt work in PG. How about CURRENT_DATE + INTERVAL '12 months'? -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
-
Re: [SQL] Date question
Jie Liang <jliang@ipinc.com> — 2001-03-06T20:02:55Z
you can say: (now() + '1year'::timespan)::date Jie LIANG St. Bernard Software 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 jliang@ipinc.com www.stbernard.com www.ipinc.com On Tue, 6 Mar 2001, Boulat Khakimov wrote: > Hi, > > Im a little bit stuck here. > > Does anyone know how to get date in format 'YYYY-MM-DD' of a date one > year from now. > So for example today is '2001-03-06' I need to get date 12 months from > now > which will be '2002-03-06' in todays case... > > In mysql I used DATE_ADD(CURDATE(), INTERVAL 12 MONTH) , but that > doesnt work in PG. > > > Regards, > Boulat Khakimov > > > -- > Nothing Like the Sun > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >
-
Re: [SQL] Date question
clayton <drfrog@smartt.com> — 2001-03-06T20:37:27Z
Francis Solomon wrote: > > Hi Boulat, > > stasis=# select (now() + '1 year')::date; > ?column? > ------------ > 2002-03-06 > (1 row) > > Hope this helps > > Francis > > > Hi, > > > > Im a little bit stuck here. > > > > Does anyone know how to get date in format 'YYYY-MM-DD' of a date one > > year from now. > > So for example today is '2001-03-06' I need to get date 12 months from > > now > > which will be '2002-03-06' in todays case... > > > > In mysql I used DATE_ADD(CURDATE(), INTERVAL 12 MONTH) , but that > > doesnt work in PG. > > > > > > Regards, > > Boulat Khakimov > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org i dunno about you but i like this syntax better than the old :: ones select date(now()+ '1 year');