Esc

date_time

procedureextension2 overloadssince 0.36.1Source
  • macOS: date_time works on macOS
  • Linux: date_time works on Linux
  • Windows: date_time works on Windows
  • Wasm: date_time works on Wasm

overload 1

date_time :: (day: Date, clock: Time_Of_Day) -> Date_Time

Combines validated civil components.

Example↗
day, _ := date(2024, 3, 10);
clock, _ := time_of_day(2, 30, 0);
wall := date_time(day, clock);
assert(wall.date.month == 3 && wall.time.hour == 2);

overload 2

date_time :: (
    year: s64,
    month: s64,
    day: s64,
    hour: s64 = 0,
    minute: s64 = 0,
    second: s64 = 0,
    nanosecond: s64 = 0
) -> (Date_Time, Time_Error)

Validates a civil date and clock reading together.

Example↗
wall, error := date_time(2024, 3, 10, 2, 30);
assert(error.kind == .NONE && wall.time.minute == 30);

See also