https://bugzilla.novell.com/show_bug.cgi?id=690475
https://bugzilla.novell.com/show_bug.cgi?id=690475#c0 Summary: Unexpected XmlConvert.ToDateTime(string,XmlDateTimeSerializationM ode) behaviour Classification: Mono Product: Mono: Class Libraries Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Sys.XML AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0 When converting a UTC time specification using the following method call: XmlConvert.ToDateTime("2009-12-15T08:44:05.2700544Z", XmlDateTimeSerializationMode.Local); the method produces the following exception: System.FormatException: Invalid format string at System.DateTime.ParseExact (System.String s, System.String[] formats, IFormatProvider provider, DateTimeStyles style) [0x0005c] in /home/jon/Development/mono-droid/mono/mcs/class/corlib/System/DateTime.cs:1761 at System.Xml.XmlConvert.ToDateTime (System.String s, System.String[] formats, DateTimeStyles style) [0x00000] in /home/jon/Development/mono-droid/mono/mcs/class/System.XML/System.Xml/XmlConvert.cs:403 at System.Xml.XmlConvert.ToDateTime (System.String s, System.String[] formats) [0x00000] in /home/jon/Development/mono-droid/mono/mcs/class/System.XML/System.Xml/XmlConvert.cs:397 at System.Xml.XmlConvert.ToDateTime (System.String value, XmlDateTimeSerializationMode mode) [0x0001d] in /home/jon/Development/mono-droid/mono/mcs/class/System.XML/System.Xml/XmlConvert.cs:371 .. The Mono implementation of this method requires that a local date time specification is passed to the method in order to work successfully. This behaviour, however, is different to the documented (and implemented) Microsoft NET Framework behaviour where the parameter XmlDateTimeSerializationMode is documented as: "One of the XmlDateTimeSerializationMode values that specify whether the date should be converted to local time or preserved as Coordinated Universal Time (UTC), if it is a UTC date." Thus the expected behaviour (which is also the actual behaviour of the MS .NET Framework) would be that the UTC date time specification is parsed successfully, and then converted to a local date time representation which is returned to the caller. Reproducible: Always Steps to Reproduce: Just call XmlConvert.ToDateTime("2009-12-15T08:44:05.2700544Z", XmlDateTimeSerializationMode.Local); Actual Results: System.FormatException: Invalid format string Expected Results: The UTC date time specification whould be parsed successfully, and then converted to a local DateTime instance which is returned to the caller. I observed this when working with Mono for Android, but I think it probably applies to all Mono class library implementations. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
