[Mono-list] DateTime formatting

Gonzalo Paniagua Javier gonzalo@ximian.com
Wed, 20 Aug 2003 12:39:41 +0200


El mié, 20-08-2003 a las 10:00, Marcus escribió:
> When using the DateTime class, I ran across some inconsistencies between 
> Mono, .NET, and the documentation (ECMA, MS) on how DateTime should be 
> formatted. Since this might be an area where comments are important, I wanted 
> to mention it here as well.
> 
> 
> 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. 
> 
> http://bugs.ximian.com/show_bug.cgi?id=47753

Yeah. Also 47720 shows another oddity.

Currently there are some tests failing for DateTimeTest. It would be
nice to get more tests that spot these differences so that we can fix
(or, well, make it behave as MS does) our DateTime.

-Gonzalo