Re: Date Arithmetic in PL/pgSql - Mailing list pgsql-novice

From Tom Lane
Subject Re: Date Arithmetic in PL/pgSql
Date
Msg-id 9237.1123535369@sss.pgh.pa.us
Whole thread Raw
In response to Re: Date Arithmetic in PL/pgSql  (John DeSoi <desoi@pgedit.com>)
Responses Re: Date Arithmetic in PL/pgSql  ("Lane Van Ingen" <lvaningen@esncc.com>)
SQL Time Issue  (<operationsengineer1@yahoo.com>)
List pgsql-novice
John DeSoi <desoi@pgedit.com> writes:
> On Aug 8, 2005, at 4:23 PM, Lane Van Ingen wrote:
>> I am trying to do some simple date arithmetic.

> select '2005-08-08 16:15:30'::timestamp - '310 seconds'::interval;

I think the "computed" part is the bit that's missing.  Maybe he wants

select '2005-08-08 16:15:30'::timestamp - (expression) * '1 sec'::interval;

This should work for pretty much any numeric expression.

            regards, tom lane

pgsql-novice by date:

Previous
From: John DeSoi
Date:
Subject: Re: Date Arithmetic in PL/pgSql
Next
From: "Jeff Eckermann"
Date:
Subject: Re: Uploading and loading