On Fri, Jul 30, 2010 at 8:55 PM, IvO <[email protected]> wrote: > Actually I can reply to my own question. > > There was nothing wrong with the way I stored UTC datetimes to the database. > The following is the output of an small test script showing what STORM > gets back frrom the DB. > > 2.1 2010-05-13 19:32:00+00:00 UTC tzutc() > > The pb was with my Postgres server configuration, I setup the timezobe > variable to UTC and everything is consistent now.
PostgreSQL "timestamp with time zone" columns do not actually store a time zone. Instead, it stores the value in UTC and converts to and from the connection's local time zone when storing and retrieving the value. Setting the connection's time zone to UTC basically makes the data type work like a "timestamp without time zone" field, except that it is formatted with a "+00:00" time zone when read. I've usually found it easier and more reliable to use the "timestamp without time zone" data type, explicitly store data in UTC, and do any time zone conversions on the client side. This way the server configuration won't affect how your application behaves. For the client side time zone conversions, I'd suggest looking at the pytz library. James. -- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
