Import std.time.zone
std.time.zone
TimeZone, a zone's rules for its clocks: one of the IANA tz database's, which the runtime embeds, like "Europe/Paris", with every offset and daylight saving change it has had and will have; a fixed offset from UTC; or the OS's own. ZonedDateTime is a moment where a zone is, its Timestamp and the date and time the zone's clocks show then.
Adding a Duration to a ZonedDateTime is exact, so an hour after 01:30 on the night the clocks go back is the second 01:30; adding days, months, or years goes by the calendar, to the same time on the clocks when the zone has it. A date and time that the clocks show twice, or skip, becomes a moment as a Disambiguation says.
std/time/zone.fb
Types
Disambiguation
enum
Public Enum Disambiguation
Which moment a date and time is where a zone's clocks show it twice, as they're turned back, or never, as they skip it.
-
As most libraries go: EARLIER for a time shown twice, and LATER for a skipped one.
-
The earlier of two, and for a skipped time, the one read with the offset from after the skip, so 02:30, on a night the clocks go from 02:00 to 03:00, is 01:30.
-
The later of two, and for a skipped time, the one read with the offset from before the skip, so 02:30, on a night the clocks go from 02:00 to 03:00, is 03:30.
TimeZone
struct
Public Struct TimeZone Implements Hashable, Printable, Defaultable
A time zone: one of the time zone database's, by its name, like "Europe/Paris", or a fixed offset from UTC.
-
UTC, which is also every TimeZone's zero.
-
The value to start from, like 0 for a number, "" for a String, or an empty collection.
-
The zone of that
offsetfrom UTC, always, which panics when it isn't whole seconds under a day. -
The zone the tz database names, like "America/New_York", or one of its old names, like "US/Eastern", in any letter case; "UTC" or "Z"; or a fixed offset as ISO 8601 writes it, like "+05:30", "+0530", or "-08". Any other name is Null.
-
The OS's zone: the tz database's of the name the OS gives, or else a fixed offset, the OS's now.
-
The tz database's names, of its zones and their old names, sorted.
-
The tz database's version, like "2026e".
-
The database's name for it, like "Europe/Paris"; "UTC"; or a fixed offset's, like "+05:30".
-
Whether its offset never changes, as a fixed offset's doesn't. A database zone's can.
-
Its offset from UTC at that moment, east of it above 0.
-
The abbreviation its clocks go by then, like "CEST", or an offset, like "+0530", where the database has none. A fixed offset's is its Name.
-
Whether its clocks are on daylight saving time then, as the tz database says, which counts Europe/Dublin's winter time as its summer time turned back.
-
The offsets its clocks have when they show the date and time: one most of the time, two, the earlier moment's first, when they're turned back past it, and none when they skip it.
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString.
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.
-
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 value to start from, like 0 for a number, "" for a String, or an empty collection.
-
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, and the abbreviation its clocks go by.
-
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 later, or earlier, 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 later, or earlier, as AddDays goes. -
The same time on the zone's clocks
countyears later, or earlier, 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.