Bug 16937 - XmlConvert.ToDateTime (.., XmlDateTimeSerializationMode.utc) returns incorrect results
Summary: XmlConvert.ToDateTime (.., XmlDateTimeSerializationMode.utc) returns incorrec...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
Depends on:
Reported: 2013-12-22 16:13 UTC by Frank R
Modified: 2014-08-18 11:17 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Frank R 2013-12-22 16:13:37 UTC
XmlConvert.ToDateTime ("2012-07-16T12:34:56Z", XmlDateTimeSerializationMode.Utc) should return a DateTime with Kind = Utc and date/time "2012-07-16 12:34:56" (as is the case for MS.NET), but it doesn't. The Kind is correct, but the date/time part is "2012-07-16 14:34:56" (while living at GMT+1).

(This may be fixed as part of resolution of https://bugzilla.xamarin.com/show_bug.cgi?id=16742)
Comment 1 Jonathan Pryor 2013-12-26 11:00:14 UTC
This happens in desktop Mono as well:

$ csharp -r:System.Xml
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> using System.Xml;
csharp> var d = XmlConvert.ToDateTime ("2012-07-16T12:34:56Z", XmlDateTimeSerializationMode.Utc);
csharp> d.Kind;
csharp> d;
7/16/2012 8:34:56 AM

Notice that `d.ToString()` shows that the time is 8:34:56AM instead of 12:34:46PM.
Comment 2 Doug G 2014-02-10 16:31:06 UTC
What's the status of this bug? This is a glaring issue.
Comment 3 marcos.henrich 2014-08-18 11:17:13 UTC
This issue is no longer reproducible in master.