time icon indicating copy to clipboard operation
time copied to clipboard

Microsoft JSON dates

Open fossdd opened this issue 3 years ago • 1 comments

I just come on a error on parsing with time that it doesn't regonized the type of microsoft's JSON used date.

A example is:

/Date(151708196000)/

The /Date( and the )/ can be removed, and then there is a known unix timestamp. Would nice if time could implement it.

In that time, how am I now able to parse this format?

fossdd avatar Jul 26 '21 16:07 fossdd

Currently you have to create customer serializer/deserializer functions to do this. By default serializing and deserializing use a single format — it will never try another if the first fails. In the future I hope to have something like #[serde(with = time::serde::format_description!("/Date([timestamp])/")] which would auto-generate a module.

jhpratt avatar Jul 26 '21 20:07 jhpratt

The [unix_timestamp] component is now implemented and documented alongside the other components.

jhpratt avatar Feb 24 '23 12:02 jhpratt