Re: [SQL] Date question

From: Michael Fork <mfork(at)toledolink(dot)com>
To: Boulat Khakimov <boulat(at)inet-interactif(dot)com>
Cc: 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:26:58
Message-ID: Pine.BSI.4.21.0103061425570.5931-100000@glass.toledolink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-06 19:27:36 Re: time to integer
Previous Message Mike Mascari 2001-03-06 19:25:28 RE: Date question

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2001-03-06 19:28:54 Re: Comparing dates
Previous Message Mike Mascari 2001-03-06 19:25:28 RE: Date question