python - Wrong aware-datetime with pytz and 'America/Chicago' -


this question has answer here:

in [57]: datetime.datetime(2015,7,7,15,30,tzinfo=pytz.timezone('america/chicago')) out[57]: datetime.datetime(2015, 7, 7, 15, 30, tzinfo=<dsttzinfo 'america/chicago' cst-1 day, 18:00:00 std>) 

notice offset, saying utc-6 (e.g -(24-18) ) while correct offset chicago on 2015-7-7 utc-5.

am missing here?

there issues timezones , pytz using localise fix:

import pytz d = datetime(2015,7,7,15,30) dt = pytz.timezone('america/chicago').localize(d)  print(dt) 2015-07-07 15:30:00-05:00 

unfortunately using tzinfo argument of standard datetime constructors ‘’does not work’’ pytz many timezones.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -