Re: [Numpy-discussion] UTC-based datetime64
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 > > > > 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.bar...@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.bar...@noaa.gov > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] UTC-based datetime64
> 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 > > 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.bar...@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.bar...@noaa.gov ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] UTC-based datetime64
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 ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion