ISO 8601 Data elements and interchange formats — Information interchange — Representation of dates and times is an international standard covering the exchange of date and time-related data. It was issued by the International Organization for Standardization (ISO) and was first published in 1988. The purpose of this standard is to provide an unambiguous and well-defined method of representing dates and times, so as to avoid misinterpretation of numeric representations of dates and times, particularly when data is transferred between countries with different conventions for writing numeric dates and times.
The standard organizes the data so the largest temporal term (the year) appears first in the data string and progresses to the smallest term (the second). It also provides for a standardized method of communicating time-based information across time zones by attaching an offset to Coordinated Universal Time (UTC).[1]
Date and time (current at page generation) expressed according to ISO 8601: | |
---|---|
Date | 2024-02-06 |
Separate date and time in UTC: | 2024-02-06 04:15Z |
Combined date and time in UTC: | 2024-02-06T04:15Z |
Date with week number: | 2024-W06-2 |
Ordinal date: | 2024-037 |
History
The first edition of the ISO 8601 standard was published in 1988. It unified and replaced a number of older ISO standards on various aspects of date and time notation: ISO 2014, ISO 2015, ISO 2711, ISO 3307, and ISO 4031.[2] It has been superseded by a second edition in 2000 and by the current third edition published on 3 December 2004.
ISO 2014 was the standard that originally introduced the big-endian all-numeric date notation [YYYY]-[MM]-[DD]. The ISO week numbering system was introduced in ISO 2015, and the identification of days by ordinal dates was originally defined in ISO 2711.
It is maintained by ISO Technical Committee TC 154.[3]
General principles
- Date and time values are organized from the most to the least significant: year, month (or week), day, hour, minute, second, and fraction of second. The lexicographical order of the representation thus corresponds to chronological order, except for date representations involving negative years. This allows dates to be naturally sorted by, for example, file systems.
- Each date and time value has a fixed number of digits that must be padded with leading zeros.
- Representations can be done in one of two formats—a basic format with a minimal number of separators or an extended format with separators added to enhance human readability.[4] The separator used between date values (year, month, week, and day) is the hyphen, while the colon is used as the separator between time values (hours, minutes, and seconds). For example, the 6th day of the 1st month of the year 2009 may be written as "2009-01-06" in the extended format or simply as "20090106" in the basic format without ambiguity. The extended formats are preferred over the basic formats not only for human readability, but because some basic formats can appear to be ambiguous to those unfamiliar with the standard.
- For reduced accuracy, any number of values may be dropped from any of the date and time representations, but in the order from the least to the most significant. For example, "2004-05" is a valid ISO 8601 date, which indicates May (the fifth month) 2004. This format will never represent the 5th day of an unspecified month in 2004, nor will it represent a time-span extending from 2004 into 2005.
- If necessary for a particular application, the standard supports the addition of a decimal fraction to the smallest time value in the representation.
Dates
<< February 2024 >> | |||||||
Wk | Mo | Tu | We | Th | Fr | Sa | Su |
(5) | 29 | 30 | 31 | 1 | 2 | 3 | 4 |
(6) | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
(7) | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
(8) | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
(9) | 26 | 27 | 28 | 29 | 1 | 2 | 3 |
The standard uses the Gregorian calendar, and serves as an international standard for civil use.[5]
ISO 8601 fixes a reference calendar date to the Gregorian calendar of 1875-05-20 as the date the Convention du Mètre (Metre Convention) was signed in Paris. However, ISO calendar dates before the Convention are still compatible with the Gregorian calendar all the way back to the official introduction of the Gregorian calendar on 1582-10-15. Earlier dates, in the proleptic Gregorian calendar, may be used by mutual agreement of the partners exchanging information. The standard states that every date must be consecutive, so usage of the Julian calendar would be contrary to the standard (because at the switchover date, the dates would not be consecutive).
Years
YYYY |
±YYYYY |
ISO 8601 prescribes, as a minimum, a four-digit year [YYYY] to avoid the year 2000 problem. It therefore represents years from 0000 to 9999, year 0000 being equal to 1 BC and all others AD.
To represent years before 0000 or after 9999, the standard also permits the expansion of the year representation but only by prior agreement between the sender and the receiver.[6]
An expanded year representation [±YYYYY] must have an agreed-upon number of extra year digits beyond the four-digit minimum, and it should always be prefixed with a + or − sign instead of the common AD/CE or BC/BCE notation; by convention year zero is labelled positive: +0000. Note the addition of a year zero causes earlier years to be different by one when converted; for example, the year 3 BC would be denoted by −0002.[7].
Calendar dates
YYYY-MM-DD | or | YYYYMMDD |
YYYY-MM | (but not YYYYMM) |
Calendar date representations are in the form as shown in the box to the right. [YYYY] indicates a four-digit year, 0000 through 9999. [MM] indicates a two-digit month of the year, 01 through 12. [DD] indicates a two-digit day of that month, 01 through 31. For example, "the 5th of April 1981" may be represented as either "1981-04-05" in the extended format or "19810405" in the basic format.
The standard also allows for calendar dates to be written with reduced precision. For example, one may write "1981-04" to mean "1981 April", and one may simply write "1981" to refer to that year or "19" to refer to that century.
Although the standard allows both the YYYY-MM-DD and YYYYMMDD formats for complete calendar date representations, if the day [DD] is omitted then only the YYYY-MM format is allowed. By disallowing dates of the form YYYYMM, the standard avoids confusion with the truncated representation YYMMDD (still often used).
Week dates
Script error: No such module "main".
YYYY-Www | or | YYYYWww |
YYYY-Www-D | or | YYYYWwwD |
Week date representations are in the format as shown in the box to the right. [YYYY] indicates the ISO week-numbering year which is slightly different to the calendar year (see below). [Www] is the week number prefixed by the letter 'W', from W01 through W53. [D] is the weekday number, from 1 through 7, beginning with Monday and ending with Sunday. This form is popular in the manufacturing industries.
There are mutually equivalent descriptions of week 01:
- the week with the year's first Thursday in it (the formal ISO definition),
- the week with 4 January in it,
- the first week with the majority (four or more) of its days in the starting year, and
- the week starting with the Monday in the period 29 December – 4 January.
If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in week 01. If 1 January is on a Friday, Saturday or Sunday, it is in week 52 or 53 of the previous year (there is no week 00). 28 December is always in the last week of its year.
The week number can be described by counting the Thursdays: week 12 contains the 12th Thursday of the year.
The ISO week-numbering year starts at the first day (Monday) of week 01 and ends at the Sunday before the new ISO year (hence without overlap or gap). It consists of 52 or 53 full weeks. The ISO week-numbering year number deviates from the number of the calendar year (Gregorian year) on a Friday, Saturday, and Sunday, or a Saturday and Sunday, or just a Sunday, at the start of the calendar year (which are at the end of the previous ISO week-numbering year) and a Monday, Tuesday and Wednesday, or a Monday and Tuesday, or just a Monday, at the end of the calendar year (which are in week 01 of the next ISO week-numbering year). For Thursdays, the ISO week-numbering year number is always equal to the calendar year number.
Examples:
- 2008-12-29 is written "2009-W01-1"
- 2010-01-03 is written "2009-W53-7"
For an overview of week numbering systems see week number. The US system has weeks from Sunday through Saturday, and partial weeks at the beginning and the end of the year. An advantage is that no separate year numbering like the ISO week-numbering year is needed, while correspondence of lexicographical order and chronological order is preserved.
Ordinal dates
YYYY-DDD | or | YYYYDDD |
An Ordinal date is a simple form for occasions when the arbitrary nature of week and month definitions are more of an impediment than an aid, for instance, when comparing dates from different calendars. As represented above, [YYYY] indicates a year. [DDD] is the day of that year, from 001 through 365 (366 in leap years). For example, "1981-04-05" is also "1981-095".
This format is used with simple hardware systems that have a need for a date system, but where including full calendar calculation software may be a significant nuisance. This system is sometimes incorrectly referred to as "Julian Date", whereas the astronomical Julian Date is a sequential count of the number of days since day 0 beginning 1 January 4713 BC Greenwich noon, Julian proleptic calendar (or noon on ISO date -4713-11-24 which uses the Gregorian proleptic calendar with a year [0000]).
Times
hh:mm:ss | or | hhmmss |
hh:mm | or | hhmm |
hh |
ISO 8601 uses the 24-hour clock system. The basic format is [hh][mm][ss] and the extended format is [hh]:[mm]:[ss].
- [hh] refers to a zero-padded hour between 00 and 24 (where 24 is only used to notate midnight at the end of a calendar day).
- [mm] refers to a minute between 00 and 59.
- [ss] refers to a second between 00 and 60 (where 60 is only used to notate an added leap second).
So a time might appear as either "134730" in the basic format or "13:47:30" in the extended format.
It is also acceptable to omit lower order time elements for reduced accuracy: [hh]:[mm], [hh][mm] and [hh] are all used.
Midnight is a special case and can be referred to as both "00:00" and "24:00". The notation "00:00" is used at the beginning of a calendar day and is the more frequently used. At the end of a day use "24:00". Note that "2007-04-05T24:00" is the same instant as "2007-04-06T00:00" (see Combined date and time representations below).
Decimal fractions may also be added to any of the three time elements. A decimal point, either a comma or a dot (without any preference as stated most recently in resolution 10 of the 22nd General Conference CGPM in 2003), is used as a separator between the time element and its fraction. A fraction may only be added to the lowest order time element in the representation. To denote "14 hours, 30 and one half minutes", do not include a seconds figure. Represent it as "14:30,5", "1430,5", "14:30.5", or "1430.5". There is no limit on the number of decimal places for the decimal fraction. However, the number of decimal places needs to be agreed to by the communicating parties.
Time zone designators
There are no time zone designators in ISO 8601. Time is only represented as local time or in relation to UTC.
or | ||
If no UTC relation information is given with a time representation, the time is assumed to be in local time. While it may be safe to assume local time when communicating in the same time zone, it is ambiguous when used in communicating across different time zones. It is usually preferable to indicate a time zone (zone designator) using the standard’s notation.
UTC
If the time is in UTC, add a 'Z' directly after the time without a space. 'Z' is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".
UTC time is also known as 'Zulu' time, since 'Zulu' is the NATO phonetic alphabet word for 'Z'.
Time offsets from UTC
The offset from UTC is given in the format ±[hh]:[mm], ±[hh][mm], or ±[hh]. So if the time being described is one hour ahead of UTC (such as the time in Berlin during the winter), the zone designator would be "+01:00", "+0100", or simply "+01". This is appended to the time in the same way that 'Z' was above. The offset from UTC changes with daylight saving time, e.g. a time offset in Chicago, would be "-06:00" for the winter (Central Standard Time) and "-05:00" for the summer (Central Daylight Time).
The following times all refer to the same moment: "18:30Z", "22:30+04", "1130-0700", and "15:00-03:30". Nautical time zone letters are not used with the exception of Z. To calculate UTC time one has to subtract the offset from the local time, e.g. for "15:00-03:30" do 15:00 − (−03:30) to get 18:30 UTC.
The offset can also be used in the case where the UTC time is known, but the local offset is not. In this case the offset is "-00:00", which is semantically different from "Z" or "+00:00", as these imply that UTC is the preferred reference point for those times.[8]
Combined date and time representations
<date>T | <date>T |
Combining date and time representations to represent a single point in time (time point) is quite simple. It is in the format of <date>T
A combined date and time representation, often called (and so named in many DBMS type ontologies) a timestamp, can be used to mark any type of event time such as an e-mail delivery, a financial transaction, the start of a medical treatment, or even a natural occurrence (like the June solstice of 2009 shown above). Combined date and time representations are also used in conjunction with time intervals as discussed later in this article.
The date and time representations may appear in proximity to each other, often separated by a space or sometimes by other characters. In these cases they occupy two separate fields in a data system, rather than a single combined representation. This is usually done for human readability. Unlike the previous examples, "2007-04-05 14:30" is considered two separate, but acceptable, representations—one for date and the other for time. It is then left to the reader to interpret the two separate representations as meaning a single time point based on the context.
Durations
PnYnMnDTnHnMnS |
PnW |
P<date>T |
Durations are a component of time intervals and define the amount of intervening time in a time interval. They should only be used as part of a time interval as prescribed by the standard. Time intervals are discussed in the next section.
Durations are represented by the format P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W as shown to the right. In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required, but the maximum number of digits for each element should be agreed to by the communicating parties. The capital letters P, Y, M, W, D, T, H, M, and S are designators for each of the date and time elements and are not replaced.
- P is the duration designator (historically called "period") placed at the start of the duration representation.
- Y is the year designator that follows the value for the number of years.
- M is the month designator that follows the value for the number of months.
- W is the week designator that follows the value for the number of weeks.
- D is the day designator that follows the value for the number of days.
- T is the time designator that precedes the time components of the representation.
- H is the hour designator that follows the value for the number of hours.
- M is the minute designator that follows the value for the number of minutes.
- S is the second designator that follows the value for the number of seconds.
For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds". Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable duration representations.
To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value). The smallest value used may also have a decimal fraction, as in "P0.5Y" to indicate half a year. This decimal fraction may be specified with either a comma or a full stop, as in "P0,5Y" or "P0.5Y". The standard does not prohibit date and time values in a duration representation from exceeding their "carry-over points" except as noted below. Thus, "PT36H" could be used as well as "P1DT12H" for representing the same duration.
Alternatively, a format for duration based on combined date and time representations may be used by agreement between the communicating parties either in the basic format PYYYYMMDDThhmmss or in the extended format P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]. For example, the first duration shown above would be "P0003-06-04T12:30:05". However, individual date and time values cannot exceed their moduli (e.g. a value of 13 for the month or 25 for the hour would not be permissible).
Time intervals
<start>/<end> |
<start>/<duration> |
<duration>/<end> |
<duration> |
A time interval is the intervening time between two time points. The amount of intervening time is expressed by a duration (as described in the previous section). The two time points (start and end) are expressed by either a combined date and time representation or just a date representation.
There are four ways to express a time interval:
- Start and end, such as "2007-03-01T13:00:00Z/2008-05-11T15:30:00Z"
- Start and duration, such as "2007-03-01T13:00:00Z/P1Y2M10DT2H30M"
- Duration and end, such as "P1Y2M10DT2H30M/2008-05-11T15:30:00Z"
- Duration only, such as "P1Y2M10DT2H30M", with additional context information
Of these, the first three require two values separated by an interval designator which is usually a solidus or forward slash "/". In certain applications, a double hyphen (--) can be used as a separator instead of a solidus (see Section 4.4.2 of the standard).
For <start>/<end> expressions, if any elements are missing from the end value, they are assumed to be the same as for the start value including the time zone. This feature of the standard allows for concise representations of time intervals. For example, the date of a two-hour meeting including the start and finish times could be simply shown as "2007-12-14T13:30/15:30", where "/15:30" imples "/2007-12-14T15:30" (the same date as the start), or the beginning and end dates of a monthly billing period as "2008-02-15/03-14", where "/03-14" implies "/2008-03-14" (the same year as the start).
If greater precision is desirable to represent the time interval, then more time elements can be added to the representation. An observation period that has a duration of approximately three days, for example, can be succinctly shown as "2007-11-13/15", i.e. from any time on 2007-11-13 to any time on 2007-11-15. If a more exact start and end of the observation period need to be shown either for clarity or for measurement and recording purposes, the same time interval representation could be expanded to "2007-11-13T00:00/15T24:00", i.e. midnight at the start (T00:00) of 2007-11-13 to midnight at the end (T24:00) of 2007-11-15, a total of 72 hours.
Repeating intervals
Rnn/<interval> |
R/<interval> |
Repeating intervals are specified in section "4.5 Recurring time interval". They are formed by adding "R[n]/" to the beginning of an interval expression, where 'R' is used as the letter itself and [n] is replaced by the number of repetitions. Leaving out the value for [n] means an unbounded number of repetitions. So, to repeat the interval of "P1Y2M10DT2H30M" five times starting at "2008-03-01T13:00:00Z", use "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M".
Truncated representations
ISO 8601:2000 allowed truncation (by agreement), where leading components of a date or time are omitted. Notably, this allowed two-digit years to be used and the ambiguous formats YY-MM-DD and YYMMDD. This provision was removed in ISO 8601:2004.
See also
Notes
- ↑ ISO, FAQ: Numeric representation of Dates and Time
- ↑ "ISO 8601:2004(E)" (PDF). ISO. 2004-12-01. Retrieved 2010-03-07.
Annex A … From that concept representations of all other date and time values were logically derived; thus, ISO 2014, ISO 3307 and ISO 4031 have been superseded. … Identification of a particular date by means of ordinal dates (ISO 2711) and by means of the week numbering system (ISO 2015) were alternative methods that the basic concept of this International Standard could also encompass; thus, ISO 2015 and ISO 2711 have now been superseded.
- ↑ TC 154 Processes, data elements and documents in commerce, industry and administration
- ↑ Numeric representation of Dates and Time
- ↑ Doggett, L. E. (1992). "Calendars". In P. K. Seidelmann (ed.). Explanatory Supplement to the Astronomical Almanac. Sausalito, California: University Science Books. p. 580. ISBN 0-935702-68-7.
The Gregorian calendar today serves as an international standard for civil use.
- ↑ "ISO 8601:2004(E)" (PDF). ISO. 2004-12-01. Retrieved 2010-03-07.
3.5 Expansion … By mutual agreement of the partners in information interchange, it is permitted to expand the component identifying the calendar year, which is otherwise limited to four digits. This enables reference to dates and times in calendar years outside the range supported by complete representations, i.e. before the start of the year [0000] or after the end of the year [9999].
- ↑ For example, see Annex B.1.1 of the standard.
- ↑ RFC 3339 — Unknown local offset convention
External links
- ISO's catalog entry for ISO 8601:2004
- Use international date format (ISO) - Quality Web Tips The World Wide Web Consortium (W3C)
- ISO 8601 at DMOZ
- ISO 8601 summary by Markus Kuhn
- Summary of 8601 by ISO
- Technical Committee ISO/TC 154, Processes, data elements and documents in commerce, industry and administration.
- The Mathematics of the ISO 8601 Calendar
- W3C Specification about UTC Date and Time and IETF Internet standard RFC 3339, based on ISO 8601
Lua error in package.lua at line 80: module 'strict' not found. Lua error in package.lua at line 80: module 'strict' not found.
af:ISO 8601 br:ISO 8601 ca:ISO 8601 cs:ISO 8601 de:ISO 8601 es:ISO 8601 eo:ISO 8601 fr:ISO 8601 ko:ISO 8601 id:ISO 8601 is:ISO 8601 it:ISO 8601 ka:ISO 8601 sw:ISO 8601 la:ISO 8601 lv:ISO 8601 hu:ISO 8601 ml:ഐ.എസ്.ഒ. 8601 nl:ISO 8601 ja:ISO 8601 no:ISO 8601 pl:ISO 8601 pt:ISO 8601 ru:ISO 8601 sq:ISO 8601 simple:ISO 8601 sk:ISO 8601 sl:ISO 8601 fi:ISO 8601 sv:ISO 8601 th:ISO 8601 uk:ISO 8601 yo:ISO 8601 zh:ISO 8601