Is there a way to extract Year / Month / Day / Hour / Minute from

In Instant in std::time - Rust , I see second / milli second / nicro second / nano second.

However, is there a way to extract year / month / day of month, hour, minute ?

There isn't.

You probably want to use chrono, either Local::now() or the Utc version. (and import the Datelike trait)


No, because Instants are not bound to any specified zero point. Given an Instant, there's no way of knowing what calendar datetime it corresponds to. All you can know is the Duration between two Instants.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.