OxL Справочник OxL
РусскийEnglish

data ZonedTime

An instant with a time zone (§17.1). time is the UTC instant, tz the zone that decides the wall clock.

Example:

oxl✓ проверяется в CI
use std.time { Time }

fn main() io {
  let moment = Time.ofUnixSeconds(1793728800).in(tz"Europe/Moscow")
  print("{moment.toIso()} {moment.date().toIso()}")
}
Вывод
2026-11-03T21:00:00+03:00[Europe/Moscow] 2026-11-03
@derive(Copy, Eq, Hash)
pub(api) data ZonedTime

Потокобезопасность. an immutable value.

С версии. 1.0.0-beta

Поля

pub(api) time: Tm

The UTC instant.

pub(api) tz: Tz

The zone that decides the wall clock.

Методы

offset() -> Dur
Offset from UTC at this instant.
isDst() -> bool
Whether daylight saving time is in force at this instant.
abbreviation() -> str
The abbreviation of the zone at this instant (CEST, MSK, ...).
local() -> Ldt
Wall clock in the zone.
date() -> Date
The date on the wall clock of the zone.
timeOfDay() -> TimeOfDay
The time of day on the wall clock of the zone.
in()
The same instant in another zone.
+(a: ZonedTime, d: Dur) -> ZonedTime
Exact arithmetic (§17.2)
-(a: ZonedTime, d: Dur) -> ZonedTime
Exact arithmetic
-(a: ZonedTime, b: ZonedTime) -> Dur
The exact duration between two zoned instants.
+(a: ZonedTime, p: Period) -> ZonedTime
Calendar arithmetic (§17.2)
-(a: ZonedTime, p: Period) -> ZonedTime
Calendar arithmetic
fmt(pattern: str) -> str
Formats with a pattern (dd.MM.yyyy HH:mm XXX VV); an empty pattern is ISO 8601 with offset and [zone].
toIso() -> str
ISO 8601 with offset and [zone].
show() -> str
The same as toIso().
parse(text: str, format: TimeFormat | str) -> ZonedTime | ParseError
Parses ISO 8601 (2026-11-03T18:00:00+03:00[Europe/Moscow]) or a pattern with XXX / VV.

Определено в: std/time/time.oxl:2153

См. также