1 2 3 4 5 6 7 8
use chrono::{DateTime, Utc};
const TWITTER_DATE_TIME_FMT: &str = "%a %b %d %H:%M:%S %z %Y";
/// Parse the time format used in Twitter API responses.
pub fn parse_date_time(input: &str) -> Result<DateTime<Utc>, chrono::ParseError> {
Ok(DateTime::parse_from_str(input, TWITTER_DATE_TIME_FMT)?.into())
}