Re: Date question

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
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: Date question
Date: 2001-03-06 19:40:25
Message-ID: Pine.LNX.4.30.0103062040000.778-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Soma Interesting 2001-03-06 19:56:04 Re: time to integer
Previous Message Peter Eisentraut 2001-03-06 19:39:21 Re: time to integer

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-03-06 19:54:28 Re: Mis-firing of rules with a WHERE condition
Previous Message Francis Solomon 2001-03-06 19:30:03 RE: [SQL] Date question