I use a drawer chronograph; after some digging, I found that the DateTime type has a timestamp() function that can generate an era time of type i64 . However, I could not 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());
time rust rust-chrono
Sajuuk
source share