[Numpy-discussion] datetime64 1970 issue

Ondřej Čertík ondrej.certik@gmail....
Wed Apr 17 16:21:09 CDT 2013


On Wed, Apr 17, 2013 at 2:09 PM, Bob Nnamtrop <bob.nnamtrop@gmail.com> wrote:
> It would seem that before 1970 the dates do not include the time zone
> adjustment while after 1970 they do. This is the source of the extra 7
> hours.
>
> In [21]: np.datetime64('1970-01-01 00')
> Out[21]: numpy.datetime64('1970-01-01T00:00-0700','h')
>
> In [22]: np.datetime64('1969-12-31 00')
> Out[22]: numpy.datetime64('1969-12-31T00:00Z','h')
>
> I saw the other thread about the time zone issues and I think getting rid of
> timezones (perhaps unless they are explicitly requested) is the right thing
> to do.

I think you are right. The timezone conversion only happens for years >= 1970:

https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/datetime_strings.c#L299

Which explains the problem.

Ondrej


More information about the NumPy-Discussion mailing list