Import std.time.zone
ZonedDateTime
struct
Public Struct ZonedDateTime Implements Comparable, Hashable, Printable, Defaultable
A moment where a zone is: its Timestamp, and the date and time the zone's clocks show then, from the year -999999999 to 999999999. Its zero is 1970-01-01T00:00:00Z in UTC.
Examples
Local paris = TimeZone.Find("Europe/Paris")
Expect(paris != Null)
If paris == Null Then Return
Local summer = ZonedDateTime(LocalDateTime(2024, 7, 1, 12, 0), paris)
Expect(summer.Offset == 2.Hours && summer.Abbreviation == "CEST")
Expect(summer.Timestamp.ToUtc().Hour == 10)
Expect(summer.AddMonths(6).Offset == 1.Hours)
Expect("{summer}" == "2024-07-01T12:00:00+02:00[Europe/Paris]")-
The moment where the
zoneis. -
@PanicsAtCaller Public New(local: LocalDateTime, zone: TimeZone, disambiguation: Disambiguation = Disambiguation.COMPATIBLE)constructor #The date and time where the
zoneis, as thedisambiguationpicks when thezone's clocks show it twice or skip it. One past the years a Timestamp holds panics. -
The Unix epoch, in UTC.
-
Now, where the
zoneis, or the OS'szone. -
Now, in the OS's zone.
-
The moment ISO 8601 writes, with its offset, and the zone's name after it or not, like "2026-10-23T14:30:00+02:00[Europe/Paris]" or "2026-10-23T12:30:00Z", or Null. Without a name, the zone is the offset's; with one, the offset has to be the zone's then.
-
@PanicsAtCaller Public Static Method Parse(text: String, pattern: String): ZonedDateTime?static method #The moment the
textwrites as thepatternsays (see format.fb), or Null. A pattern without the date, or without an offset or a zone, panics. With a zone and no offset, the zone's clocks' date and time are a moment as COMPATIBLE says. -
The moment RFC 2822 writes, like "Fri, 23 Oct 2026 14:30:00 +0200", in the zone of its offset, or Null.
-
The moment it is, as a Timestamp.
-
Its zone.
-
The zone's offset from UTC then, the time its clocks are ahead of UTC's.
-
The abbreviation the zone's clocks go by then, like "CEST".
-
Whether the zone's clocks are on daylight saving time then.
-
The date and time the zone's clocks show.
-
The date the zone's clocks show.
-
The time of day the zone's clocks show.
-
The year the zone's clocks show.
-
The month the zone's clocks show, from 1 to 12.
-
The day of the month the zone's clocks show, from 1.
-
The hour the zone's clocks show, from 0 to 23.
-
The minute the zone's clocks show, from 0 to 59.
-
The second the zone's clocks show, from 0 to 59.
-
The nanosecond of the second.
-
The day of the week the zone's clocks show.
-
The day of the year the zone's clocks show, from 1.
-
The same moment where another zone is.
-
The same time on the zone's clocks
countdays after, or before, as Date's AddDays goes. Where the clocks show it twice, it keeps its offset; where they skip it, it's the moment COMPATIBLE gives. -
The same time on the zone's clocks
countmonths after, or before, as AddDays goes. -
The same time on the zone's clocks
countyears after, or before, as AddDays goes. -
The first moment of its day on the zone's clocks: midnight, or when they reach the day, where they skip midnight.
-
baftera, exactly, whatever the zone's clocks do. -
bbeforea, exactly, whatever the zone's clocks do. -
How long it is from
btoa, which panics past the longest Duration. -
In order of their moments, and of their zones for one moment, so it agrees with ==.
-
As ISO 8601 writes it, with its offset, and its zone's name after that unless the zone is a fixed offset, like "2026-10-23T14:30:00+02:00[Europe/Paris]", "2026-10-23T12:30:00Z", and "2026-10-23T18:00:00+05:30".
-
As RFC 2822 writes it: "Fri, 23 Oct 2026 14:30:00 +0200".
-
As the
patternsays (see format.fb): Format("yyyy-MM-dd HH:mm z") is "2026-10-23 14:30 CEST".
Report an issue with this page or with FutureBlitz on GitHub.