data ZonedTime
An instant with a time zone (§17.1). time is the UTC instant, tz the zone that decides the wall clock.
Example:
use std.time { Time }
fn main() io {
let moment = Time.ofUnixSeconds(1793728800).in(tz"Europe/Moscow")
print("{moment.toIso()} {moment.date().toIso()}")
}Output
2026-11-03T21:00:00+03:00[Europe/Moscow] 2026-11-03
@derive(Copy, Eq, Hash)
pub(api) data ZonedTimeThread safety. an immutable value.
Since. 1.0.0-beta
Fields
pub(api) time: Tm | The UTC instant. |
pub(api) tz: Tz | The zone that decides the wall clock. |
Methods
offset | () -> DurOffset from UTC at this instant. |
isDst | () -> boolWhether daylight saving time is in force at this instant. |
abbreviation | () -> strThe abbreviation of the zone at this instant (CEST, MSK, ...). |
local | () -> LdtWall clock in the zone. |
date | () -> DateThe date on the wall clock of the zone. |
timeOfDay | () -> TimeOfDayThe time of day on the wall clock of the zone. |
in | ()The same instant in another zone. |
+ | (a: ZonedTime, d: Dur) -> ZonedTimeExact arithmetic (§17.2) |
- | (a: ZonedTime, d: Dur) -> ZonedTimeExact arithmetic |
- | (a: ZonedTime, b: ZonedTime) -> DurThe exact duration between two zoned instants. |
+ | (a: ZonedTime, p: Period) -> ZonedTimeCalendar arithmetic (§17.2) |
- | (a: ZonedTime, p: Period) -> ZonedTimeCalendar arithmetic |
fmt | (pattern: str) -> strFormats with a pattern (dd.MM.yyyy HH:mm XXX VV); an empty pattern is ISO 8601 with offset and [zone]. |
toIso | () -> strISO 8601 with offset and [zone]. |
show | () -> strThe same as toIso(). |
parse | (text: str, format: TimeFormat | str) -> ZonedTime | ParseErrorParses ISO 8601 (2026-11-03T18:00:00+03:00[Europe/Moscow]) or a pattern with XXX / VV. |
Defined in: std/time/time.oxl:2153