I'm using the chrono crate; after some digging I discovered the DateTime
type has a function timestamp()
which could generate epoch time of type i64
. However, I couldn't find out how to convert it back to DateTime
.
extern crate chrono;
use chrono::*;
fn main() {
let date = chrono::UTC.ymd(2020, 1, 1).and_hms(0, 0, 0);
println!("{}", start_date.timestamp());
// ...how to convert it back?
}