Re: [SQL] Re: Arithmetic operation on DATE

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Jason Wong" <postgresql(at)gremlins(dot)com(dot)hk>, "macky" <macky(at)edsamail(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: [SQL] Re: Arithmetic operation on DATE
Date: 2001-08-14 15:30:00
Message-ID: web-101885@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

Jason, Macky,

> expires = CURRENT_TIMESTAMP + 10
>
> would be 10 days from now. Don't know about months though.

That's almost correct. Try:

expires := current_timestamp + '10 days'::INTERVAL

For macky's question:

expires := current_timestamp + '6 months'::INTERVAL

I'll be posting a FAQ on data/time datatypes in PostgreSQL soon.

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

Attachment Content-Type Size
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Wieger Uffink 2001-08-14 16:11:06 nextval, sequences and sequencenames
Previous Message Gregory Wood 2001-08-14 15:11:05 Re: help on delete trigger.

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2001-08-14 15:34:51 Re: Re: DateDiff, IsNull?
Previous Message Josh Berkus 2001-08-14 15:25:20 Re: problem connecting to pg.