I have a timestamp that represents milliseconds since 1970 1432202088224
which translates to Thursday, May 21, 2015 5:54:48 AM EDT
. I'd like to write a python function that converts that timestamp to milliseconds in GMT. I can't naively add four hours (3600000
milliseconds) to the existing timestamp because half the year i'll be off by one hour.
I've tried writing a function using datetime
and pytz
def convert_mills_GMT(milliseconds):
converted_raw = datetime.datetime.fromtimestamp(milliseconds/1000.0)
date_eastern = eastern.localize(converted_raw, is_dst=True)
date_utc = date_eastern.astimezone(utc)
return int(date_utc.strftime("%s")) * 1000
using the input of 1432202088224
this function returns 1432220088000
which is Thursday, May 21, 2015 10:54:48 AM EDT
when what I want is 9:54 AM. what am I missing?