How to convert a datetime from one arbitrary timezone to another arbitrary timezone
问题 Let's say I receive an arbitrary datetime object in a request, like this, which could be coming from any possible timezone - I don't know which one. For the sake of example, pretend it comes from the East Coast import pytz from colander import iso8601 ... ests1 = iso8601.parse_date('2016-04-01T00:00:00.0000-04:00') pretend ests1 is the object that comes in Using pytz, I can find out a bit about it's timezone etz = ests1.timetz() # 00:00:00-04:00 etzi = ests1.tzinfo # <FixedOffset '-04:00'