Comment 2 for bug 1446347

Revision history for this message
Stuart Bishop (stub) wrote :

You need to use the pytz API to construct the localized timestamps, per its README

>>> import pytz
>>> central = pytz.timezone('US/Central')
>>> eastern = pytz.timezone('US/Eastern')
>>> import datetime
>>> central.localize(datetime.datetime(2010, 6, 1, 11, 17, 3, 5432)).astimezone(pytz.utc)
datetime.datetime(2010, 6, 1, 16, 17, 3, 5432, tzinfo=<UTC>)
>>> eastern.localize(datetime.datetime(2010, 6, 1, 11, 17, 3, 5432)).astimezone(pytz.utc)
datetime.datetime(2010, 6, 1, 15, 17, 3, 5432, tzinfo=<UTC>)
>>>

PEP 431 is all about fixing this and making it sane.