Esc

Date

structextensionsince 0.36.1Source
  • macOS: Date works on macOS
  • Linux: Date works on Linux
  • Windows: Date works on Windows
  • Wasm: Date works on Wasm

Declaration

Date :: struct {
    year: s16 = 1970;    month: s8 = 1;    day: s8 = 1;}

A Gregorian date in years -9999..9999; construct with date(2024, 3, 10).

Example↗
day := Date.{ 2024, 3, 10 };
assert(day.month == 3);
assert(Date.{}.year == 1970); // the default is 1970-01-01

See also