In .net Framework 4.8, am trying to serialize via YamlDotNet an object that contains a DateTime
field, usually created via a DateTime.Now
call.
I use a custom serializer for that object, seralizing with the following as the key's value. This produces a valid yaml, witch i can deserialize.
session.StartTime.ToString(CultureInfo.InvariantCulture)
Yaml generated:
StartTime: 03/27/2020 18:59:27
When deserializing i get a DateTime
Object with the same year, month, day, hour and second, but the ticks seem to different
637209323680070971
- On the original
637209323680000000
- On the deserialized one:
How can i serialize/deserialize it so the 2 objects are the same?
I don't need the accuracy the extra ticks provide, but got no clue on how to remove them or what is the proper way of solving this error