I have a process where I read in a bunch of strings in ISO 8601 format at Zulu or UTC time. For example,
2012-06-20T21:15:00Z
2012-06-20T21:16:00Z
2012-06-20T21:17:00Z
2012-06-20T21:18:00Z
I convert the strings into timezone aware python datetime objects and then save them in a binary format as integers by converting them to Unix Timestamps. For example,
dt_str = '2012-06-20T21:15:00Z'
ts = int(mktime(datetime.strptime(dt_str, '%Y-%m-%dT%H:%M:%SZ').timetuple()))
# ts = 1340241300
When I read these timestamps back into another process I would like to instantiate a numpy.datetime64 object directly from the timestamp. The problem is that datetime64 sets the timezone to my local timezone.
np_dt = np.datetime64(ts,'s')
# np_dt = numpy.datetime64('2012-06-20T21:15:00-0400')
Does anyone know of a way that I could read in my timestamp so that it is UTC time? Would I would like for np_dt to equal is numpy.datetime64('2012-06-20T21:15:00-0000')...I think.
Regards