Converting timezone-aware datetime to local time in Python
In general, to convert an arbitrary timezone-aware datetime to a naive (local) datetime, I’d use the pytz module and astimezone to convert to local time, and replace to make the datetime naive: In [76]: import pytz In [77]: est=pytz.timezone(‘US/Eastern’) In [78]: d.astimezone(est) Out[78]: datetime.datetime(2010, 10, 30, 13, 21, 12, tzinfo=<DstTzInfo ‘US/Eastern’ EDT-1 day, 20:00:00 DST>) … Read more