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

From Josh Berkus
Subject Re: [SQL] Re: Arithmetic operation on DATE
Date
Msg-id web-101885@davinci.ethosmedia.com
Whole thread Raw
In response to Re: Arithmetic operation on DATE  ("Jason Wong" <postgresql@gremlins.com.hk>)
List pgsql-novice
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@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

Attachment

pgsql-novice by date:

Previous
From: "macky"
Date:
Subject: Altering pg_conndefaults
Next
From: Joshua Franklin
Date:
Subject: ...