[Numpy-discussion] Making datetime64 timezone naive

Chris Barker chris.barker at noaa.gov
Tue Oct 13 18:04:50 EDT 2015


On Mon, Oct 12, 2015 at 12:38 AM, Nathaniel Smith <njs at pobox.com> wrote:

> > As a temporary measure, we still will parse datetimes that include a
> > timezone specification by converting them to UTC, but will issue a
> > DeprecationWarning. This is important for a smooth transition, because at
> > the very least I suspect the "Z" modifier for UTC is widely used. Another
> > option would be to preserve this conversion indefinitely, without any
> > deprecation warning.
>
> I'm dubious about supporting conversions in the long run -- even "Z"
> -- because UTC datetimes and naive datetimes are really not the same
> thing.


no -- but almost!


> OTOH maybe if we dropped this it would break everyone's code
> and they would hate us --


I think it probably would. In the current implementation, an ISO string
without an offset specifier is converted using the system's locale
timezone. So to get naive time (or UTC), we need to tack a Z (or 00:00) on
there.

So killing that would likely break a lot of code!

And excepting a Z or 00:00 and then treating it as naive, while being
perhaps misleading, would not actually change any results. So I say we keep
it.

Depreciating it eventually would be good in the long run -- but maybe when
we have actual time zone support.

I actually have no idea what people are
> doing with datetime64 outside of pandas.


What do we need to do with this not to break Panda? I'm guessing more
people use datetime64 wrapped by Pandas than any other way...

(not me, though)

> There's one (slightly) contentious API decision to make: What should we do
> > with the numpy.datetime_to_string function? As far as I can tell, it was
> > never documented as part of the NumPy API and has not been used very
> much


Well, I'm not using it :-) though I can see that it might be pretty useful.
Though once we get rid of datetime64 adjusting for the locale timezone,
maybe not anymore.

-CHB


-- 

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 at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151013/69f52cc7/attachment.html>


More information about the NumPy-Discussion mailing list