Home » Development » Change in the default short date format for English (Canada)

Change in the default short date format for English (Canada)

Windows has language packages that store country specific settings such as short date format. I have recently came across an issue that was caused by an update in Canada’s language package.

Starting with Windows Server 2012 and Windows 8, the default date format for English (Canada) – short name is en-CA – 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 binding legislation so other formats are also used.

The Government of Canada recommends that all-numeric dates in both English and French use the YYYYMMDD format codified in ISO 8601.[10] The Standards Council of Canada also specifies this as the country’s date format.[11][12]

The YYYYMMDD format is the only method of writing a numeric date in Canada that allows unambiguous interpretation, and the only officially recommended format.[2] The presence of the DD/MM/YY (international) and MM/DD/YY (American) formats often results in misinterpretation. Using these systems, the date 7 January 2016 could be written as either 07/01/16 or 01/07/16, which readers can also interpret as 1 July 2016 (or 1916); conversely, 2016-01-07 cannot be interpreted as another date.

In spite of its official status and broad usage, there is no binding legislation requiring the use of the YYYYMMDD format, and other date formats continue to appear in many contexts.

Date and time notation in Canada

There is a proposed legislation to settle the date format debate. More information about the date/time implementation in Canada can be found in this page.

Workaround for the short date format in Canada

A quick fix would be changing the date string before using it in the application. For example:

string displayOnPage2 = Calendar1.SelectedDate.ToString("dd/MM/yy");

If you are using 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);

If you are seeing “date format not recognized” error after the changes, please have a look at this post: Solved: “ORA-01830: date format picture ends before converting entire input string” and “ORA-01821: date format not recognized”

Alternative Solution

If you are fine with changing the server’s Region settings, this might be the solution you are looking for. It changes the format back to dd/MM/yyyy (or whichever date format you want) as long as you keep your server in that region. If you switch the region to another one, Windows reverts the changes back to the default so the application starts using yyyy-MM-dd again.

Short date format for Canada
Changing the date format for Canada via Region settings

As many developers and system administrators don’t want to change their machines’ settings, my recommendation would be making a code change instead as explained in the Workaround section above.

Lastly, If you want to a long timestamp to a short date, check this post out:
How to convert a long timestamp to a short date?

Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.

Leave a Comment