[Mono-bugs] [Bug 47753][Nor] New - DateTime.ToString() produces different output on Mono versus .NET

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 20 Aug 2003 03:53:43 -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 mathpup@mylinuxisp.com.

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

--- shadow/47753	2003-08-20 03:53:43.000000000 -0400
+++ shadow/47753.tmp.21077	2003-08-20 03:53:43.000000000 -0400
@@ -0,0 +1,84 @@
+Bug#: 47753
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DateTime.ToString() produces different output on Mono versus .NET
+
+Description of Problem: 
+ 
+When using the DateTime.ToString(string format) with the single-letter format 
+specifiers, such as "G", "T", or "t", .NET includes an AM/PM designator whereas Mono 
+does not.  
+ 
+For example, the MS docs claim that "T" format corresponds to the format pattern 
+of "HH:mm:ss", but the former produces "2:14:20 AM", whereas the latter produces 
+"02:14:20". This is only one example. "G" formatting, by extension, suffers the same 
+problem. 
+ 
+This seems to be one of the cases where .NET differs from the ECMA spec (and their 
+own docs). And I suspect that the only real way to fix it is to write some comparison 
+tests and check Mono's output versus .NET.  
+ 
+Although this bug might seem cosmetic, it has the potential affect round-tripping of 
+data. It also could cause problems with any of the DateTime.ParseExact() methods. 
+ 
+ 
+ 
+ 
+Steps to reproduce the problem: 
+1. mcs datetime.cs 
+2. mono datetime.exe 
+3. Repeat under .NET 
+ 
+ 
+Actual Results: 
+ 
+Under Mono: 
+ 
+02:14:20 
+02:14:20 
+ 
+ 
+Under Rotor/.NET 
+ 
+2:14:20 AM 
+02:14:20 
+ 
+ 
+Expected Results: 
+ 
+ 
+ 
+How often does this happen?  
+ 
+Always 
+ 
+ 
+Additional Information: 
+ 
+ 
+Test case: 
+ 
+using System; 
+ 
+public class Testing 
+{ 
+    public static void Main() 
+    { 
+        DateTime d = new DateTime(2003, 8, 20, 2, 14, 20, 0); 
+        Console.WriteLine(d.ToString("T", null)); 
+        Console.WriteLine(d.ToString("HH:mm:ss", null));              
+    } 
+}