Time Stamps and Intervals
The DateTime
type allows a single unified
representation of timestamps or time intervals. A timestamp
represents a point in time in the Gregorian calendar, including
time zone information. A time interval represents a time duration.
Both timestamps and intervals can be of varying precision up to a
microsecond.
Time Stamps
Timestamps are represented in the model as a 25-character string
formatted as YYYYMMDDHHmmss.mmmmmmsutc
, where the
fields are defined as follows:
YYYY
is a four digit year, with the year 1 BC represented as0000
and the year 1 AD represented as0001
.MM
is a two digit month ranging from 01 (January) to 12 (December).DD
is a two digit date within the month, from 01 to 31.HH
is a two digit hour within the day, from 00 to 23.mm
is a two digit minute within the hour, from 00 to 59.ss
is a two digit second within the minute, from 00 to 59.mmmmmm
is a 6 digit microsecond within the second starting from 000000.s
is a+
(plus) or-
(minus), indicating that the value is a timestamp, and indicating the direction of the offset from Universal Coordinated Time (UTC). A
(plus) is used for time zones east of the Greenwich meridian, and a+ -
(minus) is used for time zones west of the Greenwich meridian.utc
is a 3-digit offset from UTC, expressed in minutes.
Fields are zero-padded to ensure that the timestamp is always 25
characters long. Fields that are not significant (have precision
smaller than the source resolution) are replaced with the asterisk
*
character, starting with the least significant
field, mmmmmm
and continuing with more significant
fields. The granularity for asterisks is always the entire field,
except for the microsecond field, where the granularity is single
digits. The UTC offset field never contains asterisks.
For example, May 10th, 2022 at 11:30:45 AM Pacific daylight
savings time with millisecond precision is represented as 20220510113045.000***-480
.
Time Intervals
Time intervals are represented in the model formatted as DDDDDDDDHHMMSS.mmmmmm:000
,
where
DDDDDDDD
is the number of days in the interval.HH
is the number of hours in the interval.MM
is the number of minutes in the interval.SS
is the number of seconds in the interval.mmmmmm
is the number of microseconds in the interval.
The :
indicates that the value is an interval, and
the utc
field is always set to 000
.
Similar to time stamps, the value is zero-padded to ensure that
the length of the string is always 25 characters, and values that
are below the precision of the source are replaced with the
asterix (*
) character starting with the least
significant digit. For an interval of 1 day, 13 hours, 23 minutes,
12 seconds, and 125 milliseconds (measured with a precision of 1
millisecond) is represented as 00000001132312.125***:000
.
The granularity for asterisks is always the entire field, except
for the microsecond field, where the granularity is single digits.
Date Time Operations
Note that because both timestamps and intervals have representations that allow precision lower than the maximum possible precision, arithmetic operations on them require the use of interval arithmetic. Additional rules for operations on time stamps and intervals are specified in Appendix E of the Common Information Model (CIM) Metamodel.