ISO 8601 – Effectively Communicate Dates and Times Internationally
Date and time formats are particularly important when making deals and arranging meetings. However, in the age of digital globalisation, it is becoming increasingly difficult to specify dates and times in a way everyone understands. Various time zones around the world and different cultural customs for formatting time make it difficult to state exact times and dates across national borders. ISO 8601 solves precisely this problem. By agreeing to this international standard, all stakeholders worldwide can unambiguously specify times and dates.
The international standard ISO 8601 provides recommendations for numerical date and time formats.
You can use various tools or scripts to convert date information into the desired ISO date format. This article explains all you need to know about the international standard for dates and times.
- Free website protection with SSL Wildcard included
- Free private registration for greater privacy
- Free 2 GB email account
Basic Principles of the ISO 8601 Standard
The ISO 8601 standard defines an internationally recognised format for representing dates and times. For times, they are expressed with the notation hours-minutes-seconds. In the case of dates, the format is year-month-day. This basic format enables the numbers to be written directly after another. For greater clarity, they can also be separated by delimiters. According to the basic format of ISO 8601, the date “September 7, 2019” is written as follows: “20190907”, or when expressed with delimiters: “2019-09-07”. Times are divided into hours, minutes, and seconds. An ISO 8601 timestamp would therefore be: 12:07:22. The representation of ISO date formats does away with the need for country-specific notations, at least in electronic formats. This way, time and date information is standardised, resulting in fewer communication issues.
The ISO 8601 standard is also known as ANSI INCITS 30-1997 (R2008) or NIST FIPS PUB 4-2 in the United States. What’s more, it’s not only used for time values but also for durations. In such cases, the start date or time is separated from the following duration by the letter “P”. A duration that begins on September 6, 2019 at 8:00 pm and lasts one month, five days, and three hours would be expressed per the ISO standard as follows: 2019-09-06T20P1M5T3H.
According to the ISO standard, all values like times, dates or durations are shown in a certain order: They start with the largest unit and proceed to the next smaller value. This sequence is known as “descending notation”. It corresponds with the natural mathematic value of numbers. Larger units are therefore always written before smaller units. This is advantageous as it means the lexicographical and chronological sorting of dates and times will produce the same result.
Tabular representation of ISO 8601 dates and times
Format according to ISO 8601 | Value ranges |
---|---|
Year (Y) | YYYY, four-digit, abbreviated to two-digit |
Month (M) | MM, 01 to 12 |
Week (W) | WW, 01 to 53 |
Day (D) | D, day of the week, 1 to 7 |
Hour (h) | hh, 00 to 23, 24:00:00 as the end time |
Minute (m) | mm, 00 to 59 |
Second (s) | ss, 00 to 59 |
Decimal fraction (f) | Fractions of seconds, any degree of accuracy |
In all formats of the standard, the values for dates or times are divided into various units, such as year, month, day, hour etc. Each individual unit is represented by a fixed number of digits. Especially in scientific fields, software development, and international correspondence, the standard is used in order to reduce the risk of errors with time values. The internationally standardised ISO 8601 timestamp reduces this risk considerably.
Following the date and time values, the difference compared to the recognised universal time is often indicated (abbreviated to UTC). This is how the format takes any time zone differences or country-specific summer times into consideration. The letter “Z” is generally used as the corresponding value.
Tabular representation of ISO 8601 dates and times with time zone information
Example | Explanation |
---|---|
2019-09-07T-15:50+00 | 3:30 pm on September 7, 2019 in the time zone of universal time |
2019-09-07T15:50+00Z | Likewise, 3:30 pm on September 7, 2019 in the time zone of universal time with the addition of “Z” in the notation |
2019-09-07T15:50-04:00 | 3:30 pm on September 7, 2019 in the time zone New York (UTC with daylight saving time) |
However, it’s important to note that the valid range of years in this format only encompasses the years from 1583 to 1999. This is because the Gregorian calendar was only introduced in 1583. Although it’s possible to apply the ISO 8601 standard to times and dates before the year 1583, this requires exact coordination between the parties sharing the values in order to avoid errors.
Advantages of the ISO 8601 Standard Compared to Other Common Variants
ISO 8601 only specifies numerical notations and does not cover any dates and times in which words are included. It’s not intended as a substitute for language-dependent wording, such as “February 1, 1995”. But ISO 8601 should be applied to replace designations like “2/5/95” and “9:30 am”.
The advantages of the ISO8 8601 standard can be summarised as follows:
- Easy to read and write with software
- Easily to compare and sort with a simple string comparison
- Understandable regardless of the national language
- Cannot be confused with other common date representations
- Corresponds with the standard 24-hour time system in which the larger units (hours) are also placed in front of small units (minutes and seconds)
- Strings that contain a date followed by a time are also easy to compare and sort (e.g. “2019-09-07 20:15:00”)
- Notation is concise and has a constant length, simplifying keyboard entry and table layout
- Identical to Chinese date notation, meaning the largest cultural group (>25%) in the world is already familiar with the system
- Date values with the order “year, month, day” are also widespread, such as in Japan, Korea, Hungary, Sweden, Finland, Denmark, and some other countries
- A four-digit year format does not lead to any problems at the turn of a century
Converting Dates
The format can generally be converted in two different directions. On the one hand, a date or time value can be converted to the ISO standard from a national convention, as well as from the ISO format into the national language on the other.
When converting from the ISO date into a “simple” legible form, the ISO 8601 timestamp normally looks like this:
String dateString = "2019-09-26T07:58:30.996+0200"
This string is now structured in the date format YYYY-MM-DD. The delimiter for the time is “T” and the time format is hh:mm:ss plus the UTC suffix .sssz. The complete format is therefore: YYY-MM-DD “T” hh:mm:ss.SSSZ.
The following conversion can transform the ISO date into the typical US format, i.e. hh:mm, MM.DD.YYYY (hour, minute – month, day, year).
public String getOurDate() {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
try {
Date unformatedDate = format.parse(date);
String formatedDate = new SimpleDateFormat("HH:mm dd.MM.yyyy").format(unformatedDate);
return formatedDate;
} catch (ParseException e){
System.out.println("Error")
}
return date;
}
In addition to the manual possibilities for conversion, websites can also be found online that automatically convert timestamps to the desired format. For example: DenCode Converter. Simply enter the date in the initial format and then select the target format for conversion. The time zone can also be chosen.