Skip to content
FutureBlitz

    Install

    Import std.time.zone

    TimeZone

    std.time.zone

    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.

    Examples

    Local paris = TimeZone.Find("Europe/Paris")
    Expect(paris?.Name == "Europe/Paris")
    Expect(TimeZone.Utc().OffsetAt(Timestamp.UnixEpoch()) == Duration.Zero())
    Local india = TimeZone.Fixed(5.Hours + 30.Minutes)
    Expect(india.IsFixed && india.OffsetAt(Timestamp.Now()) == 330.Minutes)
    Expect(TimeZone.Find("Mars/Olympus") == Null)

    std/time/zone.fb, line 62

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

      UTC, which is also every TimeZone's zero.

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

      UTC.

    • @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 Name, like "Europe/Paris" or "UTC".

    Report an issue with this page or with FutureBlitz on GitHub.