timezone difference in timestamp? - Mailing list pgsql-general

From meltedown
Subject timezone difference in timestamp?
Date
Msg-id vyI3h.183348$bL1.31394@fe04.news.easynews.com
Whole thread Raw
Responses Re: timezone difference in timestamp?
Re: timezone difference in timestamp?
List pgsql-general
Short version: I'm trying to turn a unix timestamp into a psql
timestamp, but there is a 5 hour difference. Is this because of
timezones ? Can I just subtract 5 hours to get the right value ?

Detailed version:
I start with a unix timestamp:
$startofday =1162789200;

Which has this date:
Array
(
     [seconds] => 0
     [minutes] => 0
     [hours] => 0
     [mday] => 6
     [wday] => 1
     [mon] => 11
     [year] => 2006
     [yday] => 309
     [weekday] => Monday
     [month] => November
     [0] => 1162789200
)


Then I make a pgsql timestamp like this:
"select timestamp '1970-01-01' + interval '$startofday seconds' as
timestamp"

And the result is:
timestamp 2006-11-06 05:00:00 timestamp


It seems like it should be 2006-11-06 00:00:00


This seems to work but can I always get the correct value by subtracting
5 hours like this?
"select timestamp '1970-01-01' + interval '$startofday seconds'-interval
'5 hours' as timestamp"

pgsql-general by date:

Previous
From: "Ben"
Date:
Subject: PostgreSQL in an embedded platform
Next
From: "Matt Miller"
Date:
Subject: cvs HEAD initdb: vacuuming database template1 ... FATAL: could not identify a comparison function for type aclitem