Re: unexpected behavior in combining timestamps with times zone and intervals

From: Niklas Johansson <spot(at)tele2(dot)se>
To: Charles Seaton <cseaton(at)stccmop(dot)org>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: unexpected behavior in combining timestamps with times zone and intervals
Date: 2007-11-03 13:26:52
Message-ID: 7F091D58-8B83-4F23-80B7-96D5E81EE2A9@tele2.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Abandoned 2007-11-03 13:42:09 Re: Copy the database..
Previous Message Charles Seaton 2007-11-03 11:26:13 unexpected behavior in combining timestamps with times zone and intervals