-
-
Save rust-play/4c7aa05327e5e2937079a4a82daa4009 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Required dependencies in Cargo.toml: | |
| // [dependencies] | |
| // chrono = "0.4" | |
| use chrono::{TimeZone, Utc}; | |
| fn main() { | |
| // Jupiter Opposition 2011-10-29 01:34:00 UTC | |
| let datetime = Utc.with_ymd_and_hms(2011, 10, 29, 1, 34, 0).unwrap(); | |
| let unix_timestamp = datetime.timestamp(); | |
| println!("Event: Jupiter Opposition (2011)"); | |
| println!("UTC Date/Time: {}", datetime.to_rfc3339()); | |
| println!("Unix Epoch Timestamp: {}", unix_timestamp); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment