Re: Adding seconds to a time

From: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Adding seconds to a time
Date: 2010-09-15 13:46:42
Message-ID: 20100915154642.7475a465@anubis.defcon1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 15 Sep 2010 09:20:04 -0400, "Rob Richardson"
<Rob(dot)Richardson(at)rad-con(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Arvind Sharma 2010-09-15 14:33:46 Re: Neat trick
Previous Message Rob Richardson 2010-09-15 13:20:04 Re: Adding seconds to a time