Timezone handling
Russ Tyndall
russ at acceleration.net
Wed Jul 24 17:36:15 UTC 2013
On 7/24/2013 10:37 AM, Julien Danjou wrote:
> Not really unfortunatelly, unless I've missed the obvious. I've still
> have no clue on how to insert "2013-01-01 12:00:00 UTC" into PG. Your
> first example inserted "2013-01-01 04:00:00 UTC", and the second
> example inserted "2013-01-01 03:00:00 UTC". Thanks!
Baring the rest of the issues you might be experiencing with these
layered systems, "2013-01-01 11:00:00" is considered timezoneless (ie:
local zone of whatever computer is interpreting it). If you wish to
insert "2013-01-01 04:00:00 UTC" the correct spelling is "2013-01-01
04:00:00Z" or "2013-01-01 04:00:00+0" which are two spellings of a
timestamp in UTC. Both should be recognized by postegresql correctly.
This call to local-time:format-timestring should allow you to produce
timestamps in the correct zone.
(local-time:format-timestring nil
(local-time:encode-timestamp 0 0 0 12 01 01 2013)
:timezone local-time:+utc-zone+)
This wikipedia article should help.
https://en.wikipedia.org/wiki/ISO_8601
Hope this helps,
Russ Tyndall
Acceleration.net
Software Developer
More information about the postmodern-devel
mailing list