This post has been republished via RSS; it originally appeared at: IIS Support Blog articles.
Beginning with Windows Server 2012 and Windows 8, the default short date format for English (Canada) was changed from dd/MM/yyyy
to yyyy-MM-dd
.
Microsoft is not planning to revert this change as yyyy-MM-dd
is the recommended date format by The Government of Canada. However, there is no legislation about it so other formats are also used in different contexts.
Workaround
If this format change caused an issue in your application, a quick fix is that changing the date string before using it in the application:
string displayOnPage2 = Calendar1.SelectedDate.ToString("dd/MM/yy");
For CultureInfo
class, you can also change the short date pattern:
CultureInfo ci = CultureInfo.CreateSpecificCulture("en-CA");DateTimeFormatInfo dtfi = ci.DateTimeFormat;
dtfi.ShortDatePattern ="dd/MM/yyyy";
string displayOnPage1= Calendar1.SelectedDate.ToString("d", dtfi);
Alternative Solution
You can also solve this issue by changing the server’s Region settings. However, as many developers and system administrators don’t want to change server settings, my recommendation would be making a code change instead as explained above.