Re: unexpected behavior in combining timestamps with times zone and intervals - Mailing list pgsql-general

From Niklas Johansson
Subject Re: unexpected behavior in combining timestamps with times zone and intervals
Date
Msg-id 7F091D58-8B83-4F23-80B7-96D5E81EE2A9@tele2.se
Whole thread Raw
In response to unexpected behavior in combining timestamps with times zone and intervals  (Charles Seaton <cseaton@stccmop.org>)
Responses Re: unexpected behavior in combining timestamps with times zone and intervals  (Charles Seaton <cseaton@stccmop.org>)
List pgsql-general
On 3 nov 2007, at 12.26, Charles Seaton wrote:
> select ('12/31/2006 UTC'::timestamptz + '307 days 02:45:30'::interval)
> However, this gives an incorrect result (off by 1 hour)
> "2007-11-02 18:45:30-07"

Have you checked your servers TimeZone setting? Also, which Postgres
version are you running? I get the following from 8.2.5, which seems
to be correct:

test=# select ('2006-12-31 UTC'::timestamptz + '307 days
02:45:30'::interval) AT TIME ZONE 'MST';
       timezone
---------------------
2007-11-02 19:45:30

(I have a different DateStyle setting, so I had to change the input
format. I also added the 'AT TIME ZONE' statement, since my server's
in another time zone.)




Sincerely,

Niklas Johansson





pgsql-general by date:

Previous
From: Charles Seaton
Date:
Subject: unexpected behavior in combining timestamps with times zone and intervals
Next
From: Robert Treat
Date:
Subject: Re: young guy wanting (Postgres DBA) ammo