Localize datetime (timezone aware) from timezone offset
问题 I have a UTC timestamp and a timezone offset timestamp (both in milliseconds): utc_time = 1394452800000 timezoneoffset = -14400000 If I wanted to get the datetime I would do : print datetime.utcfromtimestamp(utc_time/1000) >>>2014-03-10 12:00:00 How can I localize this datetime but also the final object be timezone aware? If I divide timezoneoffset , -14400000/(3600*1000) = -4 (hours). So the final output should be: >>>2014-03-10 08:00:00-04:00 My try: from pytz import timezone from dateutil