
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, -- Francesc Alted

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?
maybe, but it's a kludge no matter how you do it :-( It's been in the list for a while to fix this, but hasn't happened yet. Partly due to me not finishing writing out the notes from SciPy 2014 where we discussed a way forward on this. Sorry, -Chris
Thanks, -- Francesc Alted
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org <javascript:_e(%7B%7D,'cvml','NumPy-Discussion@scipy.org');> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov <javascript:_e(%7B%7D,'cvml','Chris.Barker@noaa.gov');> -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov

On Tue, Sep 01, 2015 at 05:28:56PM -0700, Chris Barker wrote:
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?
maybe, but it's a kludge no matter how you do it :-(
It's been in the list for a while to fix this, but hasn't happened yet. Partly due to me not finishing writing out the notes from SciPy 2014 where we discussed a way forward on this.
Sorry,
-Chris
Plans for getting times in UTC1 at the ms accuracy? Sorry, a joke, i couldn't resist. Cheers, Jim
Thanks, -- Francesc Alted
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org <javascript:_e(%7B%7D,'cvml','NumPy-Discussion@scipy.org');> http://mail.scipy.org/mailman/listinfo/numpy-discussion
--
Christopher Barker, Ph.D. Oceanographer
Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov <javascript:_e(%7B%7D,'cvml','Chris.Barker@noaa.gov');>
--
Christopher Barker, Ph.D. Oceanographer
Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
Chris Barker
-
Francesc Alted
-
Jim Benson