Function chrono::serde::ts_milliseconds::deserialize
[−]
[src]
pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error> where
D: Deserializer<'de>,
Deserialize a DateTime
from a millisecond timestamp
Intended for use with serde
s deserialize_with
attribute.
Example:
use chrono::serde::ts_milliseconds::deserialize as from_milli_ts; #[derive(Deserialize)] struct S { #[serde(deserialize_with = "from_milli_ts")] time: DateTime<Utc> } let my_s: S = serde_json::from_str(r#"{ "time": 1526522699918 }"#)?;