[][src]Macro time::date

macro_rules! date {
    ($ ($ proc_macro : tt) *) => { ... };
}

Construct a Date with a statically known value.

The resulting expression can be used in const or static declarations.

Three formats are supported: year-week-weekday, year-ordinal, and year-month-day.

assert_eq!(
    date!(2020-W01-3),
    Date::try_from_iso_ywd(2020, 1, Wednesday).unwrap()
);
assert_eq!(date!(2020-001), Date::try_from_yo(2020, 1).unwrap());
assert_eq!(
    date!(2020-01-01),
    Date::try_from_ymd(2020, 1, 1).unwrap()
);