[Numpy-discussion] timezones and datetime64

Francesc Alted francesc at continuum.io
Thu Apr 4 13:54:38 EDT 2013

On 4/4/13 7:01 PM, Chris Barker - NOAA Federal wrote:
> Francesc Alted wrote:
>> When Ivan and me were discussing that, I remember us deciding that such
>> a small units would be useful mainly for the timedelta datatype, which
>> is a relative, not absolute time.  We did not want to make short for
>> very precise time measurements, and this is why we decided to go with
>> attoseconds.
> I thought about that -- but if you have timedelta without datetime,
> you really just have an integer -- we haven't bought anything.

Well, it is not just an integer.  It is an integer with a time scale:

In []: np.array(1, dtype='timedelta64[us]') + np.array(1, 
Out[]: numpy.timedelta64(1001,'ns')

That makes a difference.  This can be specially important for creating 
user-defined time origins:

In []: np.array(int(1.5e9), dtype='datetime64[s]') + np.array(1, 
Out[]: numpy.datetime64('2017-07-14T04:40:00.000000001+0200')

Francesc Alted

More information about the NumPy-Discussion mailing list