Question

Suppose T is numpy.datetime64 in units of ms. Is there a less obscure way to convert the units than this?

T1 = np.array( [T], dtype = 'datetime64[ns]' )[0]

I'm prefer something more guessable, and, for that matter, readable.

Was it helpful?

Solution

Is this what you're looking for?

>>> x = numpy.datetime64('2005-02-25T03:30Z', 'ms')
>>> x
numpy.datetime64('2005-02-24T22:30:00.000-0500')
>>> numpy.datetime64(x, 'ns')
numpy.datetime64('2005-02-24T22:30:00.000000000-0500')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top