Skip to content

How to sub 1 year? #577

Closed Answered by numfin
numfin asked this question in Question
May 10, 2023 · 1 comments · 1 reply
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