Doing date/time + TZ math in python
Joshua J. Kugler
joshua at eeinternet.com
Fri Jan 12 02:08:45 CET 2007
wittempj at hotmail.com wrote:
>> The problem is, how do I create a datetime object and tell it that it's
>> America/Anchorage *daylight savings time* instead of whatever the system
>> currently set at? pytz only has America/Anchorage, and I saw no way to
>> tell it explicitly that the timezone is in Daylight instead of Standard
>> time (e.g. using AKST vs. AKDT for the time zone).
>> I'm sure there is a way to do it, and I'm sure it's quite simple, but it
>> hasn't jumped out at me yet. Is there a module that I haven't seen that
>> would be better suited for this?
> It looks like3 you're 9 hours in this example:
> http://docs.python.org/lib/datetime-tzinfo.html, see e.g.
Right, I know I'm at GMT-9, and tzinfo correctly deduces that when it
creates an object. But what if I were currently at GMT-8 (my time zone on
daylight savings time) and I was importing data created during standard
time? How would I create an object and tell it this is America/Anchorage
on standard time, or conversely, how would I right now create and object
and tell it to use daylight time? In other words, how can I explicitly
specify whether or not the time object being created is daylight savings
time or not? I did not see that option in the documentation reading I did.
Lead System Admin -- Senior Programmer
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
Posted via a free Usenet account from http://www.teranews.com
More information about the Python-list