timezone difference in timestamp?

Поиск
Список
Период
Сортировка
От meltedown
Тема timezone difference in timestamp?
Дата
Msg-id vyI3h.183348$bL1.31394@fe04.news.easynews.com
обсуждение исходный текст
Ответы Re: timezone difference in timestamp?  (Martijn van Oosterhout <kleptog@svana.org>)
Re: timezone difference in timestamp?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Ben"
Дата:
Сообщение: PostgreSQL in an embedded platform
Следующее
От: "Matt Miller"
Дата:
Сообщение: cvs HEAD initdb: vacuuming database template1 ... FATAL: could not identify a comparison function for type aclitem