scipp.datetime
scipp.datetime#
- scipp.datetime(value, *, unit=<automatically deduced unit>)#
Constructs a zero dimensional
Variable
with a dtype of datetime64.- Parameters
value (
Union
[str
,int
,datetime64
]) –str: Interpret the string according to the ISO 8601 date time format.
- int: Number of time units (see argument
unit
) since scipp’s epoch (see
scipp.epoch()
).
- int: Number of time units (see argument
np.datetime64: Construct equivalent datetime of scipp.
unit (
Unit
ofthe resulting datetime.
) – Can be deduced ifvalue
is a str or np.datetime64 but is required if it is an int.
Examples
>>> sc.datetime('2021-01-10T14:16:15') <scipp.Variable> () datetime64 [s] [2021-01-10T14:16:15] >>> sc.datetime('2021-01-10T14:16:15', unit='ns') <scipp.Variable> () datetime64 [ns] [2021-01-10T14:16:15.000000000] >>> sc.datetime(1610288175, unit='s') <scipp.Variable> () datetime64 [s] [2021-01-10T14:16:15]
- Return type