In the settings for the region and language of Windows 7, my general "Format" is set to "English (USA)", but my individual patterns for dates and times are set as follows ...
Long Date: dddd, dd MMMM, yyyy
Short Date: MM/dd/yyyy
Long Time: HH:mm:ss
Short time: HH:mm
When I run the following aimed at .Net 4.0
static void Main(string[] args) { Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern); Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern); Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern); }
In the end, I get the results, as expected,
dddd, dd MMMM, yyyy MM/dd/yyyy HH:mm:ss HH:mm
But if I run it, targeting .Net 3.5 (or lower), I get:
dddd, dd MMMM, yyyy MM/dd/yyyy HH:mm:ss h:mm tt
You will notice that the long time format uses my selected Windows format, but the short one apparently uses the default value for "English (United States)".
Am I missing something?
source share