An international standard for date and time notation
The ISO-8601 international standard for date and time representation:
Date format: YYYY-MM-DD
Time format: HH:MM:SS
Even when they use the same calendar system, in different parts of the world different date notations are being used. For instance, in both USA and Europe the Gregorian calendar is being used, though 2/3/14 is a different date in the USA than it is in Europe. In the US the order is month/date/year, so that the given example represents 3 February 2014. But in most of Europe the order is date/month/year, so that that same example represents 2 March 2014. One can easily see that this may cause a lot of confusion in a world where international relations are becoming more and more important.
This ambiguity can easily be solved by using the international standard ISO-8601. In ISO-8601 the date notation is as follows:
A few noteworthy points:
- The year is written as four digits. This avoids confusion in dates like 10/11/12 where it's not clear whether the year is 10 or 12, let alone if it's 1912 or 2012.
- The order is year-month-date. By placing the year at the start it's clear that the format is neither month-date-year, nor date-month-year, so that it shouldn't confuse users in either the US or Europe.
- As separator “-” (dash) is used, not “/” (slash) and neither “.” (dot). Uniformity is crucial if you want your standard to become successful.
- Month and date are always written as two digits, so with a leading 0 for numbers less than 10.
This notation has a slew of advantages:
- The notation cannot be confused with other existing formats.
- The format has a fixed length, which is convenient for tabular data. The fixed position of the three fields also makes computer processing easier.
- Using numbers for months avoids the need for lookup tables (“Jan”, “Feb”, ...) for both reading and writing by computer programs.
- In the given order of the three fields a chronogolical sorted list can be obtained by simple alphabetical sorting.
- The format is already in use in different countries, among which China, so that already 20% of the world population is familiar with it.
- It's language-independent.
As noted a number of advantages are particularly useful for computer processing, although the separators were added for better human readability. This format including the dashes as separators is called “Extended format” in the ISO-8601 standard. If human readability is not an issue dates can be entered and stored more compactly using the “Basic format”:
YYYYMMDD, for example 20140617
Other representations and reduced precision
Sometimes a user wants to designate only a given month, without date-of-month, or even only the year. ISO-8601 allows for both:
YYYY-MM, for example 2014-06, or
YYYYMM, for example 201406
designates June 2014, and
YYYY, for example 2014
designates the year 2014, without reference to a specific month.
In industry and administration often a week number is referred to, instead of the month.
YYYY-Www, for example 2014-W25, or
YYYYWww, for example 2014W25
designates week 25 of 2014 in extended and basic format, resp.
It isn't always clear which is the first day of the week and as a result week numbers can be ambiguous; what for one person is week 25 might be week 26 for somebody else. In the US weeks usually start on Sunday, while in Europe a week usually starts on Monday. ISO-8601 has a clear definition for the first day of a week and the first week in a year:
The first day of the week is Monday, and the first week of the year is the first week with a Thursday in it.
As a result at most three days (Friday, Saturday and Sunday) may preceed week 1. They then belong to the last week of the previous year (week 52 or 53). Weekdays are 1 for Monday thru 7 for Sunday.
Day-of-week can be added, as follows:
YYYY-Www-D, for example 2014-W25-2, or
YYYYWxxD, for example 2014W252
indicates the day 2 (Tuesday) of week 25 of 2014.
Yet another way to represent a date is by ordinal date, i.e. the day number within a year:
YYYY-DDD, for example 2014-168, or
YYYYDDD, for example 2014168
indicates day 168 of the year 2014.
Time of day
Just like for dates ISO-8601 has a fixed format for the time of day:
HH:MM:SS, for example 15:28:12, or
HHMMSS, for example 152812
for extended and basic format resp.
- 24 hour notation is used, with hours (HH) ranging from 00 to 24.
- Minutes range from 00 to 59
- Seconds range from 00 to 60. A 60th second only can occur as a leap second, otherwise seconds roll over from 59 to 00.
- HH = 24 can only occur when MM and SS = 00. Then 24:00:00 for a given day is the same time as 00:00:00 the next day. (Comment: I think this is a bad choice by ISO; IMO each unique moment of time should have a single, unique representation.)
HH:MM, for example 15:28, or
HHMM, for example 1528, and
HH, for example 15
for hours and minutes, extended and basic resp., and only hours.