Closed sedrik closed 2 years ago
There's two ways to do this: impl From<Month> for u8
exists, so you can just do .into()
, or you can do month as u8
. Both have the same behavior — January is 1 and December is 12.
Oh, sorry I totally missed that.
Thanks for the great library :)
I might be overlooking something. But given a OffsetDateTime I can't find a way (except formatting) to get the numeric value for a month.
https://docs.rs/time/0.3.14/time/struct.OffsetDateTime.html#method.month returns a Month which doesn't seem to expose a numeric representation that I can find.
I would like to avoid formatting as that returns a Result, currently I have my own function that converts a Month into it's numeric value but it would be nice if the time library exposed this directly.