Re: [SQL] Arithmetic operation on DATE - Mailing list pgsql-novice

From Karel Zak
Subject Re: [SQL] Arithmetic operation on DATE
Date
Msg-id 20010813121113.A1336@zf.jcu.cz
Whole thread Raw
In response to Arithmetic operation on DATE  ("macky" <macky@edsamail.com>)
List pgsql-novice
On Mon, Aug 13, 2001 at 05:48:57PM +0800, macky wrote:
> is it possible to add a date datatype column to a number resulting to a
> date......
>
>
> theoretically it should do this,,,
>
> X is in months
>
> date + X = date
>
> -->  2001-08-20 + 6 = 2002-02-20

test=# select '2001-08-20'::date + '6months'::interval;
        ?column?
------------------------
 2002-02-20 00:00:00+01
(1 row)


 ..see docs about the "interval" datetype.

            Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

pgsql-novice by date:

Previous
From: Christopher Sawtell
Date:
Subject: Re: [SQL] Arithmetic operation on DATE
Next
From: "Oliver Elphick"
Date:
Subject: Re: find and replace content