-
How to sub 1 year from OffsetDateTime? let extra_day = if current_year() % 4 === 0 { 1 } else { 0 };
days(365 + extra_day); is not a very clean solution :D |
Beta Was this translation helpful? Give feedback.
Answered by
numfin
May 10, 2023
Replies: 1 comment 1 reply
-
this one works too i guess let now = time::OffsetDateTime::now_utc();
let sub_year = now.replace_year(now.year() - 1); but |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
numfin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this one works too i guess
but
sub_year/day/month/etc()
will be much cleaner