dahomey-technologies/Dahomey.Cbor

Storing a DateTime in CborValue/CborObject

Closed this issue · 2 comments

Is it possible to store a DateTime in CborValue/CborObject?

Hi @dekenless,

A CborValue is a generic object model meant to represent CBOR basic types.

Date & time are not part of CBOR basic types. However you could represent a DateTime either in a CBOR String in its ISO representation or in a CBOR integer in its Unix time representation. Alternatively you could also opt for a CBOR double to represent milliseconds in the fractional part of the double.

Hi @dekenless,

A CborValue is a generic object model meant to represent CBOR basic types.

Date & time are not part of CBOR basic types. However you could represent a DateTime either in a CBOR String in its ISO representation or in a CBOR integer in its Unix time representation. Alternatively you could also opt for a CBOR double to represent milliseconds in the fractional part of the double.