Skip to content
FutureBlitz

    Install

    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.

    std/time/zone.fb, line 32

    • COMPATIBLE enum member #

      As most libraries go: EARLIER for a time shown twice, and LATER for a skipped one.

    • EARLIER enum member #

      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.

    • LATER enum member #

      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.

    std/time/zone.fb, line 48

    • Public Static Method Utc(): TimeZone static method #

      UTC, which is also every TimeZone's zero.

    • Public Static Method DefaultValue(): TimeZone static method #

      The value to start from, like 0 for a number, "" for a String, or an empty collection.

      Doc from std.core.interfaces.Defaultable.DefaultValue.

    • @PanicsAtCaller Public Static Method Fixed(offset: Duration): TimeZone static method #

      The zone of that offset from UTC, always, which panics when it isn't whole seconds under a day.

    • Public Static Method Find(name: String): TimeZone? static method #

      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.

    • Public Static Method System(): TimeZone static method #

      The OS's zone: the tz database's of the name the OS gives, or else a fixed offset, the OS's now.

    • Public Static Method Names(): String[] static method #

      The tz database's names, of its zones and their old names, sorted.

    • Public Static Method Version(): String static method #

      The tz database's version, like "2026e".

    • Public Property Name: String property #

      The database's name for it, like "Europe/Paris"; "UTC"; or a fixed offset's, like "+05:30".

    • Public Property IsFixed: Bool property #

      Whether its offset never changes, as a fixed offset's doesn't. A database zone's can.

    • Public Method OffsetAt(time: Timestamp): Duration method #

      Its offset from UTC at that moment, east of it above 0.

    • Public Method AbbreviationAt(time: Timestamp): String method #

      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.

    • Public Method IsDaylightSavingAt(time: Timestamp): Bool method #

      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.

    • Public Method OffsetsAt(local: LocalDateTime): Duration[] method #

      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.

    • Public Method ToString(): String method #

      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.

    std/time/zone.fb, line 180

    • Public New(time: Timestamp, zone: TimeZone) constructor #

      The moment where the zone is.

    • @PanicsAtCaller Public New(local: LocalDateTime, zone: TimeZone, disambiguation: Disambiguation = Disambiguation.COMPATIBLE) constructor #

      The date and time where the zone is, as the disambiguation picks when the zone's clocks show it twice or skip it. One past the years a Timestamp holds panics.

    • Public Static Method DefaultValue(): ZonedDateTime static method #

      The value to start from, like 0 for a number, "" for a String, or an empty collection.

      Doc from std.core.interfaces.Defaultable.DefaultValue.

    • Public Static Method Now(zone: TimeZone): ZonedDateTime static method #

      Now, where the zone is, or the OS's zone.

    • Public Static Method Now(): ZonedDateTime static method #

      Now, in the OS's zone.

    • Public Static Method Parse(text: String): ZonedDateTime? static method #

      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 text writes as the pattern says (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.

    • Public Static Method ParseRfc2822(text: String): ZonedDateTime? static method #

      The moment RFC 2822 writes, like "Fri, 23 Oct 2026 14:30:00 +0200", in the zone of its offset, or Null.

    • Public Property Timestamp: Timestamp property #

      The moment it is, as a Timestamp.

    • Public Property Zone: TimeZone property #

      Its zone.

    • Public Property Offset: Duration property #

      The zone's offset from UTC then, and the abbreviation its clocks go by.

    • Public Property Abbreviation: String property #

      The abbreviation the zone's clocks go by then, like "CEST".

    • Public Property IsDaylightSaving: Bool property #

      Whether the zone's clocks are on daylight saving time then.

    • Public Property DateTime: LocalDateTime property #

      The date and time the zone's clocks show.

    • Public Property Date: Date property #

      The date the zone's clocks show.

    • Public Property Time: TimeOfDay property #

      The time of day the zone's clocks show.

    • Public Property Year: Int property #

      The year the zone's clocks show.

    • Public Property Month: Int property #

      The month the zone's clocks show, from 1 to 12.

    • Public Property Day: Int property #

      The day of the month the zone's clocks show, from 1.

    • Public Property Hour: Int property #

      The hour the zone's clocks show, from 0 to 23.

    • Public Property Minute: Int property #

      The minute the zone's clocks show, from 0 to 59.

    • Public Property Second: Int property #

      The second the zone's clocks show, from 0 to 59.

    • Public Property Nanosecond: Int property #

      The nanosecond of the second.

    • Public Property DayOfWeek: Weekday property #

      The day of the week the zone's clocks show.

    • Public Property DayOfYear: Int property #

      The day of the year the zone's clocks show, from 1.

    • Public Method WithZone(zone: TimeZone): ZonedDateTime method #

      The same moment where another zone is.

    • @PanicsAtCaller Public Method AddDays(count: Int64): ZonedDateTime method #

      The same time on the zone's clocks count days 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.

    • @PanicsAtCaller Public Method AddMonths(count: Int64): ZonedDateTime method #

      The same time on the zone's clocks count months later, or earlier, as AddDays goes.

    • @PanicsAtCaller Public Method AddYears(count: Int64): ZonedDateTime method #

      The same time on the zone's clocks count years later, or earlier, as AddDays goes.

    • @PanicsAtCaller Public Method StartOfDay(): ZonedDateTime method #

      The first moment of its day on the zone's clocks: midnight, or when they reach the day, where they skip midnight.

    • @PanicsAtCaller Operator +(a: ZonedDateTime, b: Duration): ZonedDateTime operator #

      b after a, exactly, whatever the zone's clocks do.

    • @PanicsAtCaller Operator -(a: ZonedDateTime, b: Duration): ZonedDateTime operator #

      b before a, exactly, whatever the zone's clocks do.

    • @PanicsAtCaller Operator -(a: ZonedDateTime, b: ZonedDateTime): Duration operator #

      How long it is from b to a, which panics past the longest Duration.

    • Operator <(a: ZonedDateTime, b: ZonedDateTime): Bool operator #

      In order of their moments, and of their zones for one moment, so it agrees with ==.

    • Public Method ToString(): String method #

      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".

    • Public Method ToRfc2822(): String method #

      As RFC 2822 writes it: "Fri, 23 Oct 2026 14:30:00 +0200".

    • @PanicsAtCaller Public Method Format(pattern: String): String method #

      As the pattern says (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.