Esc

to_zoned

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

Resolves civil time and borrows the explicit zone.

Signature

to_zoned :: (
    wall: Date_Time,
    zone: Time_Zone,
    disambiguation := Disambiguation.COMPATIBLE
) -> (Zoned, Time_Error)
Example↗
zone, zone_error := time_zone_from_posix("EST5EDT,M3.2.0,M11.1.0");
assert(zone_error.kind == .NONE);
defer time_zone_free(*zone);
fold := Date_Time.{ .{ 2024, 11, 3 }, .{ 1, 30, 0, 0 } };
first, _ := to_zoned(fold, zone, .EARLIER);
second, _ := to_zoned(fold, zone, .LATER);
assert(first.offset.seconds == -14400 && second.offset.seconds == -18000);

See also