[Mono-bugs] [Bug 73410][Maj] New - Convert.ToDateTime fails without a cultureinfo object
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 6 Mar 2005 20:37:57 -0500 (EST)
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 jason@emeraldshield.com.
http://bugzilla.ximian.com/show_bug.cgi?id=73410
--- shadow/73410 2005-03-06 20:37:57.000000000 -0500
+++ shadow/73410.tmp.12672 2005-03-06 20:37:57.000000000 -0500
@@ -0,0 +1,47 @@
+Bug#: 73410
+Product: Mono: Runtime
+Version: 1.0
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: jason@emeraldshield.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Convert.ToDateTime fails without a cultureinfo object
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+Using Convert.ToDateTime() without a culture object throws an exception
+and states the object is not a valid datetime. Passing the culture
+solves, the problem, but it not required in dot net 1.0 or 1.1.
+
+Steps to reproduce the problem:
+DateTime dateCrawled = Convert.ToDateTime("3/6/2005 6:58:26 PM");
+
+Actual Results:
+EXCEPTION: String was not recognized as a valid DateTime.
+
+
+Expected Results:
+Should have placed the DateTime into the object.
+
+How often does this happen?
+Always.
+
+Additional Information:
+
+The following code will prevent it from happening, but is not required in
+1.0 or 1.1 of Dot Net.
+
+System.IFormatProvider format = new System.Globalization.CultureInfo("en-
+US", true);
+DateTime dateCrawled = Convert.ToDateTime(lastCrawled, format);