[Mono-list] DateTime.ToBinary and DateTime.FromBinary not compatible with .NET

Jonathan Gagnon jonathan.gagnon at croesus.com
Mon Oct 1 15:10:39 EDT 2007

I'm trying to serialize a DateTime and ensure that it is serialized in a
time zone independant way, so that I can deserialize it anywhere and that it
still represents the same point in time.  I'm using the methods
DateTime.ToBinary and DateTime.FromBinary to do that.  In .NET, it is
working properly, but in mono, dates that are of the DateTimeKind.Local are
not deserialized properly.  
When serializing a DateTime that is identified as local, .NET converts the
ticks in UTC, so that when it is time to deserialize it, they can convert it
back using the local machine settings and have a DateTime that identifies
the same point in time.  Mono doesn't do any conversion, and there is no way
to know what is the TimeZone of the serialized date, so I don't think it is
correct.  This also makes mono's implementation incompatible with .NET.
Should I file a bug about this issue?
Jonathan Gagnon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20071001/7cfe593c/attachment-0001.html 

More information about the Mono-list mailing list