Skip to content
FutureBlitz

    Install

    Import std.time.zone

    ZonedDateTime

    std.time.zone

    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]")

    std/time/zone.fb, line 210

    • 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 Unix epoch, in UTC.

    • 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, the time its clocks are ahead of UTC's.

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

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

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

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

      The same time on the zone's clocks count years after, or before, 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.