Date is usually represented in Gregorian calendar (named after Pope Gregory XIII who introduced it in 1582).
Unfortunately, like many other things, dates have different forms around the world which cause confusion.
A date consists of day, month and year. The day and year are usually represented in numeric form, whereas month can also be represented by its name.
The order also changes with each country: year usually comes last, but day and month can both be first/second. This means these can all mean the same date:
This causes a problem of possibly ambiguous dates such as 04/10/2020 which can mean both April 10, 2020 and 04 October 2020.
Dates can also have different separators such as:
To solve this issue, ISO 8601 was introduced. It defines a format of yyyy-mm-dd which means the date is written from largest to smallest unit of time: year, then month, then day.
This also makes the date lexicographic ordered so it can be easily sorted by databases.
Since it is ordered backwards from most formats and the year comes first, it is easy to distinguish it. Despite all its advantages, it is not commonly used by people.
In computer science, however, it is used broadly.
A common way of defining a date format is using the letters “d, m, y” to define how the day, month and year are represented.
Although it changes between platforms, the guideline is the same: the longer the repetition of a letter, the longer the text.
For example:
So the date “2020-15-01” in the format “mmm d, yyyy” would be written as “Jan 15, 2020”.
The correct format to use really depends of the audience. For a local news channel, the local format should be used since that is what people would expect.
For an online game that has players from around the world, a date which includes month by name (like the previous example) should be used as it is unambiguous.
Our default date format is similar to the named month format we mentioned (“mmm d, yyyy”) except we also add the day of week, and omit the year if it is the current year.
We also allow users to choose different formats based on their preferences, and even choose different languages.