Francesc Alted
2015-08-26 15:38:20 UTC
Hi,
We've found that NumPy uses the local TZ for printing datetime64 timestamps:
In [22]: t = datetime.utcnow()
In [23]: print t
2015-08-26 11:52:10.662745
In [24]: np.array([t], dtype="datetime64[s]")
Out[24]: array(['2015-08-26T13:52:10+0200'], dtype='datetime64[s]')
Googling for a way to print UTC out of the box, the best thing I could find
is:
In [40]: [str(i.item()) for i in np.array([t], dtype="datetime64[s]")]
Out[40]: ['2015-08-26 11:52:10']
Now, is there a better way to specify that I want the datetimes printed
always in UTC?
Thanks,
We've found that NumPy uses the local TZ for printing datetime64 timestamps:
In [22]: t = datetime.utcnow()
In [23]: print t
2015-08-26 11:52:10.662745
In [24]: np.array([t], dtype="datetime64[s]")
Out[24]: array(['2015-08-26T13:52:10+0200'], dtype='datetime64[s]')
Googling for a way to print UTC out of the box, the best thing I could find
is:
In [40]: [str(i.item()) for i in np.array([t], dtype="datetime64[s]")]
Out[40]: ['2015-08-26 11:52:10']
Now, is there a better way to specify that I want the datetimes printed
always in UTC?
Thanks,
--
Francesc Alted
Francesc Alted