pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Sawtell <csawtell@paradise.net.nz>
To: macky <macky@edsamail.com>
To: pgsql-novice@postgresql.org
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] Arithmetic operation on DATE
Date: Mon, 13 Aug 2001 22:01:59 +1200
Message-ID: <20010813100119.3FECD1FA04B@deborah.paradise.net.nz> (raw)
In-Reply-To: <001401c123dd$2c383430$5764a8c0@edsamail.com>
References: <001401c123dd$2c383430$5764a8c0@edsamail.com>

On Mon, 13 Aug 2001 21:48, macky wrote:
> is it possible to add a date datatype column to a number resulting to a
> date......

chris=# select date(CURRENT_TIMESTAMP);
    date
------------
 2001-08-13
(1 row)
 
chris=# select date(CURRENT_TIMESTAMP) + '6 @days'::interval;
        ?column?
------------------------
 2001-08-19 00:00:00+12
(1 row)
 
chris=# select date(date(CURRENT_TIMESTAMP) + '6 @days'::interval);
    date
------------
 2001-08-19
(1 row)

That what you want?

> theoretically it should do this,,,
>
> X is in months
>
> date + X = date
>
> -->  2001-08-20 + 6 = 2002-02-20
>
> ----------------------------------------------------------------------
> The information contained in this message (including any attachments)
> is confidential and intended solely for the attention and use of the
> named addressee(s). It must not be copied, distributed nor disclosed
> to any person. If you are not the intended recipient, please delete
> it from your system and notify sender immediately. Any disclosure,
> copying or distribution thereof or any action taken or omitted to be
> taken in reliance thereon is prohibited and may be unlawful.
> ----------------------------------------------------------------------
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster



view thread (8+ messages)  latest in thread

Message-ID: <20010813100119.3FECD1FA04B@deborah.paradise.net.nz>
Permalink:  ../20010813100119.3FECD1FA04B@deborah.paradise.net.nz/
Also on:    postgresql.org/message-id/20010813100119.3FECD1FA04B@deborah.paradise.net.nz

 · 

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: csawtell@paradise.net.nz, macky@edsamail.com, pgsql-novice@postgresql.org
  Subject: Re: [SQL] Arithmetic operation on DATE
  In-Reply-To: <20010813100119.3FECD1FA04B@deborah.paradise.net.nz>

* 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