[Mono-bugs] [Bug 60912][Nor] Changed - DateTime.Parse() does not support pattern "6/28/2004 12:00:00 AM"

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 30 Jun 2004 03:48:02 -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 atsushi@ximian.com.

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

--- shadow/60912	2004-06-30 03:23:35.000000000 -0400
+++ shadow/60912.tmp.12199	2004-06-30 03:48:02.000000000 -0400
@@ -78,6 +78,23 @@
      string dateText=newDate.ToString(); // creates the string 
 1/1/1980 12:00:00 AM
      Console.WriteLine("string ver is {0}", dateText);
      secondDate = DateTime.Parse(dateText,CultureInfo.InvariantCulture);
 
 
+
+------- Additional Comments From atsushi@ximian.com  2004-06-30 03:48 -------
+Robert, run my example code _under MS.NET_ and you will find that it
+is culture dependent (many culture fails to parse that string). 
+
+One more thing, it is undocumented feature that MS's invariant culture
+can parse "6/28/2004 12:00:00 AM". At least, that DateTime pattern
+never appears in DateTimeFormat.GetAllDateTimePatterns():
+
+foreach (string s in
+CultureInfo.InvariantCulture.DateTimeFormat.GetAllDateTimePatterns ())
+	Console.WriteLine (s);
+
+Ian, you should create call ToString() with InvariantCulture. In my
+box it never creates "1/1/1980 12:00:00 AM". With InvariantCulture, it
+creats "01/01/1980 00:00:00" that can be parsed fine with mono.
+