OxL Reference

type Date

A calendar date (the type is declared in the prelude; literal 2026-11-03).

Example:

oxl✓ checked in CI
use std.time { Date }

fn main() io {
  let d: Date = Date.of(2026, 11, 3)!
  print("{d.toIso()} {d.isLeapYear()}")
}
Output
2026-11-03 false
pub(api) type Date = std.core.Date

Since. 1.0.0-beta

Methods

of(year: i64, month: i64, day: i64) -> Date | InvalidValue
Validated constructor
epochDay() -> i64
Days since 1970-01-01.
ofEpochDay(n: i64) -> Date | InvalidValue
The date n days after 1970-01-01.
year() -> i64
The year of the date.
month() -> i64
The month of the date, 1 to 12.
day() -> i64
The day of the month, 1 to 31.
weekday() -> Weekday
The day of the week.
dayOfYear() -> i64
1-based day of the year.
isLeapYear() -> bool
True when the year of the date is a leap year.
lengthOfMonth() -> i64
Days in this date's month.
plusDays(n: i64) -> Date
The date n days later (negative
plusMonths(n: i64) -> Date
Calendar months; the day is clamped to the end of a shorter month (01-31 + 1 month = 02-28).
plusYears(n: i64) -> Date
The date n years later.
daysUntil(other: Date) -> i64
Whole days from this date to other (negative when other is earlier).
atStartOfDay() -> Ldt
Midnight of this date.
atTime(t: TimeOfDay) -> Ldt
The local date-time at the time of day t on this date.
+(d: Date, p: Period) -> Date
The date after adding a calendar period (the day is clamped to the length of the month).
-(d: Date, p: Period) -> Date
The date before subtracting a calendar period (the day is clamped to the length of the month).
fmt(pattern: str) -> str
Formats with a pattern (dd.MM.yyyy); an empty pattern is ISO 8601 (2026-11-03).
toIso() -> str
The date as ISO 8601
parse(text: str, format: TimeFormat | str) -> Date | ParseError
Parses ISO 8601 (.Iso8601, the default) or a pattern

Defined in: std/time/time.oxl:92

See also