When created d2=datetime(2015, 8, 1, 0, 0, 0, 0, local_tz)this way. He does not cope with summertime. But local_tz.localize()does.
d1 -
datetime.datetime(2015, 8, 1, 0, 0,
tzinfo=<DstTzInfo 'America/Los_Angeles' PDT-1 day, 17:00:00 DST>)
d2 -
datetime.datetime(2015, 8, 1, 0, 0,
tzinfo=<DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>)
You can see that they do not represent the same time.
d2great if you are going to work with UTC. Because UTC does not have daylight saving time to handle.
So, the correct way to process your timezone using local_tz.localize()
levi source
share