14.7.3 Date and Time Combined
class | |||||||||
|
The date.DateTime class privately implements Comparable, so date.DateTime instances can be compared with operators like < and >. A date.DateTime instance is serializable.
~hour: 18, ~minute: 14)
> dt
DateTime(
~year: 2025,
~month: 11,
~day: 14,
~hour: 18,
~minute: 14,
~second: 0,
~nanosecond: 0
)
"2025-11-14 18:14:00"
> dt > date.DateTime.from_seconds(0)
#true
5
function | ||||
|
If the operating system reports a time within a leap second, then the reported time is the end of the preceding second.
> date.DateTime.from_seconds(0, ~local: #false)
DateTime(
~year: 1970,
~month: 1,
~day: 1,
~hour: 0,
~minute: 0,
~second: 0,
~nanosecond: 0
)
method | ||||
|
> def dt1 = date.DateTime(~year: 1968, ~month: 1, ~day: 24, ~second: 10)
"1968-01-24 00:00:10"
"Wed, 24 Jan 1968 00:00:10 +0000"