Created
November 18, 2017 19:31
-
-
Save rschulman/f982e1750ea4aae523d59209f9eca666 to your computer and use it in GitHub Desktop.
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
named!(date<&str, NaiveDateTime>, do_parse!( | |
y: digit >> | |
tag_s!("-") >> | |
m: digit >> | |
tag_s!("-") >> | |
d: digit >> | |
new_time: value!(NaiveTime::from_hms(0, 0, 0), do_parse( | |
alt!(tag_s!("T") | tag_s!(" ")) >> | |
time)) >> | |
(NaiveDateTime::new(NaiveDate::from_ymd(i32::from_str(y).unwrap(), u32::from_str(m).unwrap(), u32::from_str(d).unwrap()), new_time)) | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment