Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux