[Mono-bugs] [Bug 74775][Nor] New - DateTime.ParseExact FormatException
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 30 Apr 2005 12:35:38 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by joe_audette@yahoo.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74775
--- shadow/74775 2005-04-30 12:35:38.000000000 -0400
+++ shadow/74775.tmp.21819 2005-04-30 12:35:38.000000000 -0400
@@ -0,0 +1,129 @@
+Bug#: 74775
+Product: Mono: Class Libraries
+Version: 1.1
+OS: SUSE 9.2
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: joe_audette@yahoo.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: DateTime.ParseExact FormatException
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+DateTime.ParseExact raises a FormatException on mono that it doesn't raise
+on Windows when the date string is in this format:
+Tue, 12 Apr 2005 10:10:04 +0000
+
+
+Steps to reproduce the problem:
+1. See simple ASP.NET test page that illustrates the problem.
+The page works under windows but throws a FormatException under mono
+If you don't want to use the page, this is all the code needed to prduce
+the error on mono while it works correctly on Windows:
+
+System.Globalization.CultureInfo ci = CultureInfo.InvariantCulture;
+
+ string dateString = "Tue, 12 Apr 2005 10:10:04 +0000";
+ string dateFormat =
+ ci.DateTimeFormat.RFC1123Pattern.Replace("'GMT'", "zzz");
+
+
+
+ DateTime theDate = DateTime.ParseExact(dateString, dateFormat, ci,
+DateTimeStyles.AllowWhiteSpaces);
+
+2.
+3.
+
+Actual Results:
+FormatException is thrown.
+
+
+Expected Results:
+DateTime is correctly parsed from string
+
+
+How often does this happen?
+Every time
+
+
+Additional Information:
+
+Heres a simple web page that you can use to test:
+
+<% @Import Namespace="System.Data" %>
+<% @Import Namespace="System.Globalization" %>
+
+<script language="c#" runat="server">
+
+
+
+ void Page_Load(Object o, EventArgs e)
+ {
+
+ // no errors on Windows
+ System.Globalization.CultureInfo ci = CultureInfo.InvariantCulture;
+
+ string dateString = "Tue, 12 Apr 2005 10:10:04 +0000";
+
+ string dateFormat =
+ ci.DateTimeFormat.RFC1123Pattern.Replace("'GMT'", "zzz");
+
+ lblRawDate.Text = dateString;
+ lblFormatString.Text = dateFormat;
+
+
+
+
+ DateTime theDate;
+
+
+ theDate = DateTime.ParseExact(dateString, dateFormat, ci,
+DateTimeStyles.AllowWhiteSpaces);
+
+
+
+
+
+
+
+ }
+
+
+
+</script>
+
+
+<html>
+ <head><title>Test DateTime.Parse</title></head>
+
+ <body>
+ <form runat="server">
+
+ <h3>DateTime.Parse this works under Windows </h3>
+
+ <h5>theDate = DateTime.ParseExact("Tue, 12 Apr 2005 10:10:04
++0000", dateFormat, CultureInfo.InvariantCulture,
+DateTimeStyles.AllowWhiteSpaces);</h5>
+
+ <br><asp:Label ID="lblRawDate" runat="server"></asp:Label>
+ <br>Using this format string <asp:Label ID="lblFormatString"
+runat="server"></asp:Label>
+
+
+
+
+
+ </form>
+ </body>
+
+</html>