Esc

to_civil

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

Converts an instant in an explicit zone, rejecting civil range overflow.

Signature

to_civil :: (zone: Time_Zone, instant: Timestamp) -> Date_Time
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);
instant, _ := parse(Timestamp, "2024-03-10T07:30:00Z");
wall := to_civil(zone, instant);
assert(wall.time.hour == 3 && wall.time.minute == 30);

See also