Skip to main content

serialize

Function serialize 

Source
pub fn serialize<S>(
    date: &DateTime<Utc>,
    serializer: S,
) -> Result<S::Ok, S::Error>
where S: Serializer,
Expand description

Writes a UTC date-time as text with milliseconds and a Z, for example 2026-10-19T07:05:00.000Z.

Use it through #[serde(with = "...")]. Time below a millisecond is cut off.

§Errors

Only the errors of the serializer. Formatting itself cannot fail.