pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karel Zak <zakkr@zf.jcu.cz>
To: macky <macky@edsamail.com>
Cc: pgsql-novice@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Arithmetic operation on DATE
Date: Mon, 13 Aug 2001 12:11:13 +0200
Message-ID: <20010813121113.A1336@zf.jcu.cz> (raw)
In-Reply-To: <001401c123dd$2c383430$5764a8c0@edsamail.com>
References: <001401c123dd$2c383430$5764a8c0@edsamail.com>

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



view thread (8+ messages)  latest in thread

Message-ID: <20010813121113.A1336@zf.jcu.cz>
Permalink:  ../20010813121113.A1336@zf.jcu.cz/
Also on:    postgresql.org/message-id/20010813121113.A1336@zf.jcu.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: zakkr@zf.jcu.cz, macky@edsamail.com, pgsql-novice@postgresql.org
  Subject: Re: [SQL] Arithmetic operation on DATE
  In-Reply-To: <20010813121113.A1336@zf.jcu.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox