Localizing Epoch Time with pytz in Python
Im working on converting epoch timestamps to dates in different timezones with pytz. What I am trying to do is create a DateTime object that accepts an Olson database timezone and an epoch time and returns a localized datetime object. Eventually I need to answer questions like "What hour was it in New York at epoch time 1350663248?" Something is not working correctly here: import datetime, pytz, time class DateTime: def __init__(self, timezone, epoch): self.timezone = timezone self.epoch = epoch timezoneobject = pytz.timezone(timezone) datetimeobject = datetime.datetime.fromtimestamp( self