Re: Problem with interval

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bruno Pr?vost <bp(at)interaction(dot)ws>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem with interval
Date: 2004-10-06 21:47:55
Message-ID: 20041006214755.GA9678@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-10-06 21:53:11 Re: Problem with interval
Previous Message Bruno Prévost 2004-10-06 20:26:06 Problem with interval