My computer is configured with a culture that is not en-US.

When using the native Win32 GetDateFormat function, i get correctly formatted dates:

  • 22//11//2011 4::42::53 P̰̃M]

This is correct; and is also how Windows renders it:

  • the taskbar

    enter image description here

  • Region and Language settings

    enter image description here

  • Windows Explorer

    enter image description here

  • Outlook

    enter image description here

When i try to convert a date to a string in .NET using my current locale, e.g.:

DateTime.Now.ToString();
DateTime.Now.ToString(CultureInfo.CurrentCulture);

i get an incorrect date:

  • 22////11////2011 4::::42::::53 P̰̃M]

This bug in .NET is evident anyplace in Windows that uses the buggy .NET code:

  • Windows Event Viewer:

    enter image description here

  • Task Scheduler:

    enter image description here

  • SQL Server Management Studio:

    enter image description here

How do i make .NET not buggy?

How do i convert dates and times to strings using the current c

Edit
Report