Re: Problem with interval - Mailing list pgsql-bugs

From Michael Fuhr
Subject Re: Problem with interval
Date
Msg-id 20041006214755.GA9678@winnie.fuhr.org
Whole thread Raw
In response to Problem with interval  (Bruno Prévost <bp@interaction.ws>)
List pgsql-bugs
On Wed, Oct 06, 2004 at 04:26:06PM -0400, Bruno Pr?vost wrote:
>
> I'm using postgres version 7.4.5 and had a problem with interval
>
> Here is my query :
> select '2004/10/31'::timestamptz + '1 day'::interval;
>
> Here is the answer :
> 10/31/2004 11:00:00 PM

I'd guess that Daylight Saving Time is the culprit -- most places
that use it revert to Standard Time on 31 Oct this year.  Suppose
you're in the EST5EDT time zone, which is 4 hours behind UTC during
the summer.  '2004/10/31'::timestamptz is '2004-10-31 00:00:00-04'.
If you add one day, that would be '2004-11-01 00:00:00-04'.  Only
by then you're 5 hours behind UTC instead of 4 hours behind, so the
time becomes '2004-10-31 23:00:00-05', which is the same time adjusted
for your time zone.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-bugs by date:

Previous
From: Bruno Prévost
Date:
Subject: Problem with interval
Next
From: "Sean Utt"
Date:
Subject: Re: Problem with interval