[Mono-list] DateTime formatting

Marcus mathpup@mylinuxisp.com
Wed, 20 Aug 2003 03:00:19 -0500

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.