Re: Date Interval - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: Date Interval
Date
Msg-id 20051206170902.GA97204@winnie.fuhr.org
Whole thread Raw
In response to Re: Date Interval  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-sql
On Tue, Dec 06, 2005 at 11:54:05AM -0500, Bruce Momjian wrote:
> test=> SELECT current_timestamp + cast(x || ' months' AS INTERVAL) FROM
> test;
>            ?column?
> -------------------------------
>  2006-03-06 11:53:05.574279-05
> (1 row)

Or another way:

test=> CREATE TABLE test (x numeric);
CREATE TABLE
test=> INSERT INTO test VALUES (3);
INSERT 0 1
test=> SELECT current_timestamp + x * interval'1 month' FROM test;          ?column?            
-------------------------------2006-03-06 12:07:48.112765-05
(1 row)

-- 
Michael Fuhr


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Date Interval
Next
From: Tom Lane
Date:
Subject: Re: lost in system tables