Created
May 23, 2016 20:24
-
-
Save qolop/8a721d9ac8217a378c3fc3ec817cc8d7 to your computer and use it in GitHub Desktop.
Get the name of the current day in Rust.
This file contains 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
extern crate time; | |
fn main() { | |
let t = time::now(); | |
match t.tm_wday { | |
0 => println!("Sunday"), | |
1 => println!("Monday"), | |
2 => println!("Tuesday"), | |
3 => println!("Wednesday"), | |
4 => println!("Thursday"), | |
5 => println!("Friday"), | |
6 => println!("Saturday"), | |
_ => panic!("Erroneous value: {}", t.tm_wday), | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment