Struct foxbox_taxonomy::values::TimeStamp
[−]
[src]
pub struct TimeStamp(_);
An absolute time and date.
JSON
Represented by a string. This data structure accepts string formatted as RFC 3339 such as
"2014-11-28T21:45:59.324310806+09:00"
.
extern crate chrono; extern crate foxbox_taxonomy; use foxbox_taxonomy::values::*; use foxbox_taxonomy::parse::*; use foxbox_taxonomy::serialize::*; use chrono::Datelike; let parsed = TimeStamp::from_str("\"2014-11-28T21:45:59.324310806+09:00\"").unwrap(); let date_time = parsed.as_datetime().clone(); assert_eq!(date_time.year(), 2014); assert_eq!(date_time.month(), 11); assert_eq!(date_time.day(), 28); let serialized: JSON = parsed.to_json(&mut MultiPart::new()); assert!(serialized.as_string().unwrap().starts_with("2014-11-28"));