#date-time #chrono #epoch #times #convert #epochs-rust

epochs

Convert various epoch times to chrono::NaiveDateTime times

5 releases

Uses old Rust 2015

0.2.4 Feb 14, 2020
0.2.3 Jan 17, 2020
0.2.2 Jan 17, 2020
0.2.1 Jan 17, 2020
0.2.0 Jan 17, 2020

#514 in Date and time

Download history 331/week @ 2024-08-19 226/week @ 2024-08-26 195/week @ 2024-09-02 24/week @ 2024-09-09 14/week @ 2024-09-16 42/week @ 2024-09-23 23/week @ 2024-09-30 152/week @ 2024-10-07 18/week @ 2024-10-14 10/week @ 2024-10-21 22/week @ 2024-10-28 80/week @ 2024-11-04 124/week @ 2024-11-11 375/week @ 2024-11-18 112/week @ 2024-11-25 414/week @ 2024-12-02

1,026 downloads per month
Used in 6 crates (3 directly)

MPL-2.0 license

22KB
310 lines

Epochs-rust

Convert various epoch times to chrono::NaiveDateTime times in Rust.

Add the following under dependencies in your Cargo.toml

epochs = "0.2"

Then this

$ cat src/main.rs 
fn main() {
    if let Some(ndt) = epochs::unix(1234567890) {
        println!("{:?}", ndt);
    }
    if let Some(ndt) = epochs::chrome(12879041490654321) {
        println!("{:?}", ndt);
    }
}

would produce this

$ cargo run
...
2009-02-13T23:31:30
2009-02-13T23:31:30.654321

See Also

This project was originally done in Perl. See the Time::Moment::Epoch web page for motivation.

There are also versions in:

Dependencies

~1MB
~18K SLoC