
A time value is typically preceded by the T designator. The T can be omitted if there is no risk of confusing datetime calculator the time with the date. However, it should be omitted only if agreed upon by both partners of the communication exchange. Note that the characters used for seconds (ss) include 00 — 60 in their range, rather than 00 — 59. This is done to incorporate leap seconds.
ISO 8601 standard time characters
Figure 3. ISO 8601 uses specific characters to represent time components within specific ranges.
The fraction characters for hours, minutes and seconds (h, m and s) can be one or more digits. If used with hours, the time value cannot include minutes (mm) or seconds (ss). If used with minutes, the time value cannot include seconds. However, either a comma or a period can be used to separate a fraction from its root time segment. For example, the time 6:11 a.m. and 54.17 seconds can be represented as T061154,17, T06:11:54,17, T061154.17 or T06:11:54.17.
As with the date formats, the ISO standard limits which time elements can stand alone. In this case, only the hour format (hh) can be specified by itself. Minutes (mm) must be used with hours, and seconds (ss) must be used with minutes. Additionally, the character combinations must conform to the ISO specification, just like with dates. For example, ss:mm:hh or some other unapproved mix cannot be used.
ISO 8601 acceptable time character combinations
Figure 4. ISO 8601’s acceptable combinations of time characters and examples.
There are no extended formats for hour or hour/fraction, but there are for the other formats. As with date values, all time values must include the exact number of digits specified by the ISO standard. For example, 4:08 a.m. and 6 seconds must be specified as T040806 or T04:08:06, not T486 or T4:8:6. The only exception to this is the fractional time periods. In the table, they’re represented as three digits, but they can be any agreed-upon number of digits.
The beginning of the day is expressed as either T000000 or T00:00:00, and the end of the day is expressed as either T240000 or T24:00:00. This means that the end of one calendar day (T24:00:00) coincides with the start of the next calendar day (T00:00:00). The shorter formats can also be used for these values, such as T00:00 and T24:00.
Working across time zones
The ISO 8601 standard also provides for time zone differences, as they relate to UTC. Time zone information is tagged onto the end of a time value. A time can be specified as being the same as UTC or as being ahead or behind it. When ahead or behind, the time difference must be expressed in hours or in hours and minutes. The table in Figure 5 shows how to add time zone information to time values. It also provides examples of the different formats.
ISO 8601 standard time zone differences
Figure 5. How to add time zone information to time value with examples of the different formats, according to ISO 8601.
The placeholder represents a valid time value, which can include any of the approved ISO time formats. The Z designator indicates that the time zone is UTC and needs only to be tagged onto the time value.
If a local time zone is the same or ahead of UTC, a plus sign should be added after the time value, followed by the number of hours or number of hours and minutes. If a local time zone is behind UTC, a minus sign should be added after the time value, followed by the number of hours or number of hours and minutes. The minutes should be omitted only if the time difference is exactly an integral number of hours.
Leave a comment