Esc

with_zone

procedureextensionsince 0.36.1Source
  • macOS: with_zone works on macOS
  • Linux: with_zone works on Linux
  • Windows: with_zone works on Windows
  • Wasm: with_zone works on Wasm

Keeps the instant while borrowing a different zone and resolving its offset.

Signature

with_zone :: (value: Zoned, zone: Time_Zone) -> Zoned
Example↗
instant, _ := timestamp_from_seconds(0);
o, _ := offset(32400);
tokyo := with_zone(zoned(instant, time_zone_utc()), time_zone_fixed(o));
assert(tokyo.timestamp.seconds == 0 && tokyo.offset.seconds == 32400);

See also