DateAndTime

This a python binding to the C++ class Mantid::Kernel::DateAndTime.

The equivalent object in python is numpy.datetime64. The two classes have a different EPOCH. Note that mantid.kernel.DateAndTime uses the GPS epoch of 1990, where numpy.datetime64 uses the unix epoch of 1970. For that reason, there is an additional method mantid.kernel.DateAndTime.to_datetime64().

To convert an array of mantid.kernel.DateAndTime, analgous to what mantid.kernel.FloatTimeSeriesProperty.times() does internally, use the code:

times = np.array(times, dtype=np.int64) * np.timedelta64(1,'ns') + np.datetime64('1990-01-01T00:00')

With numpy.datetime64, finding the number of seconds between two times is simply

diff = (timeArray[-1]-timeArray[0]) / np.timedelta64(1, 's')
class mantid.kernel.DateAndTime((object)self, (str)ISO8601 string)
__init__((object)self, (str)ISO8601 string) → None :
Construct from an ISO8601 string
__init__( (object)self, (float)seconds, (float)nanoseconds) -> None :
Construct using a number of seconds and nanoseconds (floats)since 1990-01-01T00:00
__init__( (object)self, (int)seconds, (int)nanoseconds) -> None :
Construct using a number of seconds and nanoseconds (integers) since 1990-01-01T00:00
__init__( (object)self, (int)total_nanoseconds) -> None :
Construct a total number of nanoseconds since 1990-01-01T00:00
__init__( (object)arg1, (object)other) -> object :
Construct from numpy.datetime64
setToMinimum((DateAndTime)self) → None
to_datetime64((DateAndTime)self) → object :

Convert to numpy.datetime64

totalNanoseconds((DateAndTime)self) → int :

Since 1990-01-01T00:00

total_nanoseconds((DateAndTime)self) → int :

Since 1990-01-01T00:00