Search code examples
c#datetime-formatwindows-server-2012

Default Date Patterns in Windows server 2012 has changed


Long Date Pattern for en-US in Windows server 2012 (dddd, MMMM d, yyyy) is different than what it used to be on older windows versions (dddd, MMMM dd, yyyy), and since any .net application inherits the default culture formats from system the following code blocks generate different outputs based on windows version.

DateTimeFormatInfo myDTFI = new CultureInfo("en-US", false).DateTimeFormat;
Console.WriteLine("  {0}     {1}", "en-US", myDTFI.LongDatePattern);

myDTFI = new CultureInfo("tr-TR", false).DateTimeFormat;
Console.WriteLine("  {0}     {1}", "tr-TR", myDTFI.ShortDatePattern);

This finding is contrary to what is being stated on the Examples section of the MSDN article http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.longdatepattern.aspx

I have also updated my server but the difference still continues. Can you please verify that it is also the same on your Windows 2012 servers as well.


Solution

  • You can change the default datetime settings on the server as described in this article:

    http://support.microsoft.com/kb/2905782

    To work around this change, revert the date formats to the original formats that are mentioned in the "Summary" section. To do this, use the Change date, time or number formats item in Control Panel.