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.
You need to use the pytz API to construct the localized timestamps, per its README
>>> import pytz 'US/Central' ) 'US/Eastern' ) localize( datetime. datetime( 2010, 6, 1, 11, 17, 3, 5432)). astimezone( pytz.utc) datetime( 2010, 6, 1, 16, 17, 3, 5432, tzinfo=<UTC>) localize( datetime. datetime( 2010, 6, 1, 11, 17, 3, 5432)). astimezone( pytz.utc) datetime( 2010, 6, 1, 15, 17, 3, 5432, tzinfo=<UTC>)
>>> central = pytz.timezone(
>>> eastern = pytz.timezone(
>>> import datetime
>>> central.
datetime.
>>> eastern.
datetime.
>>>
PEP 431 is all about fixing this and making it sane.