time::macros

Macro utc_datetime

Source
utc_datetime!() { /* proc-macro */ }
Available on crate feature macros only.
Expand description

Construct a UtcDateTime with a statically known value.

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

The syntax accepted by this macro is the same as a space-separated date! and time!.

assert_eq!(
    utc_datetime!(2020-01-01 0:00),
    Date::from_calendar_date(2020, Month::January, 1)?.midnight().as_utc()
);