Wait til you see my 'O' [pattern]

by Michael S. Kaplan, published on 2006/03/14 08:35 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/03/14/551112.aspx


(no, this post is not about a rap or hip hop song, or its lyrics, though I admit the title may have been inspired by one!)

Internationalization guru Bill Hall asked of some folks here:

I have a small question to ask.  Some time ago when you were helping me with some issues in my monographs on .NET I18n, you once sent me a response saying that it was rather strange that I would run through the standard number formats using the single ascii character formatters a-z and A-Z, trying each one to see if a corresponding format or number expression would emerge.  As it happened in that instance, I discovered that the ‘P’ and ‘p’ formats for percentage were not documented anywhere in .NET 1.1.

Well, I’m doing a series for multilingual about what is new for .NET 2.0 and I tried the same experiment, this time for DateTime.  Guess what?  The ‘o’ and ‘O’ formats are missing in the .NET 2.0 documentation!  The pattern is yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK for both, and it is clearly an ISO 8601 form but I cannot find any reference to it.

It would be nice to know what .NET calls it.  ISO calls it a ‘complete’ format – a bit vague.  I’d like to provide the official .NET name in my article and I wonder if you could help.

Many thanks.

Well, I agree with Bill here -- it is hard to argue with results, and clearly he is managing to stay at least a few steps in front of the documentation by using such tricks. It keeps us honest. :-)

So, there are the existing, documented formats you can find in the DateTimeFormatInfo.GetAllDateTimePatterns(char) overload -- this lists some of them, but there are many more, some that can be found in other help topics. Here is the full list as of 2.0 for date formats, all of the ones that can be used with that method:

(The items in green are independent of culture, while the ones in black are not.

As the above list indicates, I do not know of an official name for this 'o'/'O' format: no one I talked to does (through reflection, you can see the name of the format is DateTimeFormat.RoundtripFormat, but that is not the actual name, it is just an internal thing).

Enjoy!

 

This post brought to you by "O" (U+004f, a.k.a. LATIN CAPITAL LETTER O)


Adam on 14 Mar 2006 9:58 AM:

# 's' -- The sortable date time pattern (allows sorting by date value), "yyyy'-'MM'-'dd'T'HH':'mm':'ss"

Hmmmm....does that follow RFC 2550 (http://www.ietf.org/rfc/rfc2550.txt) for dates after 10,000AD?

:)

Michael S. Kaplan on 14 Mar 2006 3:32 PM:

Well, when the Y10K isue hits, we'll be too busy fixing the old COBOL applications to worry about *that* issue. :-)

Mattias on 14 Mar 2006 4:56 PM:

From the subject I thought the post was about the movie Office Space. "If things go right I might be showing her my O-face. You know: Oh. Oh."  :-) http://www.imdb.com/title/tt0151804/quotes

Michael S. Kaplan on 14 Mar 2006 7:36 PM:

Heh heh -- yes, Mattias, that reference works too....

:-)

Dean Harding on 15 Mar 2006 9:20 PM:

The DateTime structure only supports dates between 1st Jan in the year 1 and 31st Dec in the year 9999, so there's a lot more to worry about than just how it formats dates in Y10k!!

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2011/06/08 Wait til you see my Õ (Ō), Latvian edition

2007/07/12 Wait til you see my 'O'[EMCP based technology]

go to newer or older post, or back to index or month or day