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

Robert Jordan robertj at gmx.net
Mon Oct 1 16:39:25 EDT 2007


Jonathan Gagnon wrote:
> 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?

Yes, please file one together with a test case.

Thanks
Robert



More information about the Mono-list mailing list