[Mono-bugs] [Bug 75353][Nor] New - DateTime.Parse problem en-GB: ok on 1.1.6, fails on 1.1.8

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jun 22 14:59:49 EDT 2005


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 kevin-f at linkprior.com.

http://bugzilla.ximian.com/show_bug.cgi?id=75353

--- shadow/75353	2005-06-22 14:59:49.000000000 -0400
+++ shadow/75353.tmp.22108	2005-06-22 14:59:49.000000000 -0400
@@ -0,0 +1,86 @@
+Bug#: 75353
+Product: Mono: Class Libraries
+Version: 1.1
+OS: SUSE 9.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: kevin-f at linkprior.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DateTime.Parse problem en-GB: ok on 1.1.6, fails on 1.1.8
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+Under en-GB CultureInfo, DateTime.ToShortDateString produces correct 
+format but DateTime.Parse does not convert it back - swaps over day & 
+month so produces wrong value or throws FormatException. 
+
+Steps to reproduce the problem:
+1. Compile and run this code:
+
+//
+// code starts
+//
+using System;
+
+namespace test
+{
+	class Class1
+	{
+
+		static void Main(string[] args)
+		{
+			String s;
+			DateTime d;
+
+			// Set en-GB culture
+			System.Globalization.CultureInfo ci;
+			ci = new System.Globalization.CultureInfo("en-
+GB");
+		
+	System.Threading.Thread.CurrentThread.CurrentCulture = ci;
+
+			// Get a date
+			d = DateTime.Parse("2005-09-13");
+			
+			// Convert to string and display
+			s = d.ToShortDateString();
+			Console.WriteLine(s);
+
+			// Convert back and display
+			// - works on Mono 1.1.6, fails on 1.1.8.1
+			d = DateTime.Parse(s);
+
+			Console.WriteLine(d.ToShortDateString());
+			Console.Read();
+			
+
+		}
+	}
+}
+
+//
+// code ends
+//
+
+Actual Results:
+Date written to console once, then FormatException.
+
+Expected Results:
+Date written to console twice.
+
+How often does this happen? 
+
+
+Additional Information:
+Knock-on effects for things like setting DataView.RowFilter when date 
+literal used, e.g. dv.RowFilter = "TALK_DATE < #" & 
+dNextMtgDate.ToShortDateString & "#"


More information about the mono-bugs mailing list