date!() { /* proc-macro */ }Expand description
Returns the compile date as time::Date.
By default, the returned date is in UTC, call date!(local)
to return the local date.
ยงExample
Get the UTC date:
const COMPILE_DATE: time::Date = compile_time::date!();
let year = COMPILE_DATE.year();
let month = COMPILE_DATE.month();
let day = COMPILE_DATE.day();
println!("Compiled on {month} {day}, {year}.");Get the date for the local time zone:
const COMPILE_DATE: time::Date = compile_time::date!(local);
let year = COMPILE_DATE.year();
let month = COMPILE_DATE.month();
let day = COMPILE_DATE.day();
println!("Compiled on {month} {day}, {year}.");