From: | meltedown <asdf(at)fake(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | timezone difference in timestamp? |
Date: | 2006-11-06 15:30:35 |
Message-ID: | vyI3h.183348$bL1.31394@fe04.news.easynews.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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"
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Bernier | 2006-11-06 15:33:46 | Re: Need replacement booth member for USENIX Lisa |
Previous Message | Joshua D. Drake | 2006-11-06 15:27:53 | Re: Need replacement booth member for USENIX Lisa |