Library / Date and time / Date and time / DateTime
DateTime
UTC wall-clock instant, millisecond precision.
Fields 7
int32 yearint32 monthint32 dayint32 hourint32 minuteint32 secondint32 millisecondConstructors 2
INIT()Construct from the current wall-clock instant (UTC). Always valid — system time cannot be outside the representable range.
INIT(int64 epochMs)
Construct from a raw Unix epoch ms value. Primarily used by DateTimeFactory.newDateTime after it has validated components and computed epochMs via Calendar.fieldsToEpochMs — that is the supported path for explicit construction, because it surfaces a pipe-XOR FAILURE on out-of-range. Direct use is also fine if you already hold a known-valid epoch (e.g. from another DateTime, from a database column). An epoch outside [year 1, year 9999] splits into proleptic-Gregorian fields outside that range; no FAILURE is raised here, so prefer DateTimeFactory.newDateTime for untrusted input.
Methods 10
METHOD getEpochMs() RETURNS int64reads
Wall-clock instant as milliseconds since the Unix epoch (UTC).
METHOD isLessThan(REFERENCE DateTime other) RETURNS booleanreads
Comparable[DateTime] — strict less-than on epochMs (UTC). The
ordering operators (<, <=, >, >=) are derived by the
compiler from this single method per Comparable's convention.
METHOD equals(REFERENCE DateTime other) RETURNS booleanreads
Equatable[DateTime] — Comparable's parent. Two DateTimes are equal iff their epochMs match; broken-down field equality is a derived consequence (both split by Calendar from the same ms).
METHOD compareTo(REFERENCE DateTime other) RETURNS TimeComparisonreads
Explicit three-way comparison — for callers that want the named
TimeComparison enum (BEFORE / EQUAL / AFTER) rather than
composing the Comparable primitives. Both surfaces are
intentional per Phase 0 #3 LOCKED.
METHOD __op_plus__(REFERENCE TimeDuration d) RETURNS DateTimereads
dt + td — shift forward by d. UTC.
METHOD __op_minus__(REFERENCE TimeDuration d) RETURNS DateTimereads
dt - td — shift back by d. UTC.
METHOD __op_minus__(REFERENCE DateTime other) RETURNS TimeDurationreads
dt - dt' — the TimeDuration FROM other TO self. Sign
follows the convention later - earlier > 0.
METHOD format(REFERENCE String pattern) RETURNS Stringreads
Render this DateTime against pattern, substituting each
recognised token with its zero-padded field value and copying
every other character verbatim.
METHOD hash() RETURNS uint64reads
FNV-1a 64-bit hash of epochMs, mixed as 8 little-endian bytes. epochMs is the canonical state — two DateTimes with equal epochMs are Equatable-equal and must hash identically.
METHOD clone() RETURNS DateTimereads
Field copy. Routes through INIT(int64) so the broken-down decomposition runs once on the clone; epochMs is the source of truth, the seven public fields are derived.