Macro time::macros::date [−][src]
macro_rules! date {
($($proc_macro : tt) *) => { ... };
}
Expand description
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)?);
assert_eq!(date!(2020-001), Date::try_from_yo(2020, 1)?);
assert_eq!(date!(2020-01-01), Date::try_from_ymd(2020, 1, 1)?);