Re: Adding seconds to a time - Mailing list pgsql-novice

From Jean-Yves F. Barbier
Subject Re: Adding seconds to a time
Date
Msg-id 20100915154642.7475a465@anubis.defcon1
Whole thread Raw
In response to Re: Adding seconds to a time  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
Responses Re: Adding seconds to a time
List pgsql-novice
On Wed, 15 Sep 2010 09:20:04 -0400, "Rob Richardson"
<Rob.Richardson@rad-con.com> wrote:


Be careful though, there might be a '+1x' shift:
SELECT now();                       => 2010-09-15 15:39:02.838245+02
see:
SELECT now() + '1 month'::interval; => 2010-10-15 15:39:27.518034+02

I guess that is an SQL rule, but it is not "legally" correct, when you
calculate a contract termination date for example (which should be
2010-10-14.)

> And, of course, as soon as I post the question I find the answer,
> through a more intelligent search:
>
> Multiply the number by a standard interval:
>     select N * '1 second'::interval
>
> RobR
>


--
I tried the clone syscall on me, but it didn't work.
        -- Mike Neuffer trying to fix a serious time problem

pgsql-novice by date:

Previous
From: "Rob Richardson"
Date:
Subject: Re: Adding seconds to a time
Next
From: Arvind Sharma
Date:
Subject: Re: Neat trick