Skip to content
Discussion options

You must be logged in to vote

this one works too i guess

let now = time::OffsetDateTime::now_utc();
let sub_year = now.replace_year(now.year() - 1);

but sub_year/day/month/etc() will be much cleaner

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jhpratt
Comment options

Answer selected by numfin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants