home
NOTE: Under Construction - I'm in the middle of upgrading my site and lots of stuff is kinda broken. Please forgive the mess.

Print The Current Date/Time Timestamp In Rust

April 2024
Code
```cargo
[dependencies]
chrono = "0.4"
```

fn main() {
  let timestamp = chrono::prelude::Local::now();
  println!("{}", timestamp.to_string());
  println!("{}", timestamp.to_rfc3339());
  println!("{}", timestamp.to_rfc2822());
  println!("{}", timestamp.format("%Y-%m-%d %H:%M:%S"));
}
Results
2024-05-18 16:42:34.195878 -04:00
2024-05-18T16:42:34.195878-04:00
Sat, 18 May 2024 16:42:34 -0400
2024-05-18 16:42:34
═══ § ═══

Footnotes And References