pub fn parse(input: &str) -> Result<DateTime<Local>, NotParsable>Expand description
This function will take a string as an input and try to parse it into a valid Datetime with the local timezone.
Examples found in repository?
examples/print-date.rs (line 15)
6fn main() {
7 let mut args: Vec<String> = env::args().collect();
8 args.remove(0);
9
10 if let None = args.first() {
11 println!("You need to pass the input as an argument.");
12 return;
13 }
14
15 match parse(args.first().unwrap()) {
16 Ok(dt) => println!("{:?}", dt),
17 Err(_) => println!("Cannot parse input as a date")
18 }
19}