RE: [SQL] Date question

From: "Francis Solomon" <francis(at)stellison(dot)co(dot)uk>
To: "Boulat Khakimov" <boulat(at)inet-interactif(dot)com>, <pgsql-sql(at)postgresql(dot)org>, <psql-novice(at)postgresql(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: RE: [SQL] Date question
Date: 2001-03-06 19:30:03
Message-ID: NEBBIFFPELJMCJAODNPKOEKLCHAA.francis@stellison.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Wood 2001-03-06 19:30:50 Re: SQL article
Previous Message Martin A. Marques 2001-03-06 19:28:09 Re: PostgreSQL 7 on Solaris 8 - Is it working?

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2001-03-06 19:40:25 Re: Date question
Previous Message Jie Liang 2001-03-06 19:28:54 Re: Comparing dates