Current date and time expressed according to ISO 8601 [{{purge|refresh}}] | |
Label1: | Date |
Label2: | Time in UTC |
Data2: | |
Label3: | Date and time in UTC |
Data3: | |
Label4: | Date and time with the offset |
Data4: | |
Label5: | Week |
Label6: | Week with weekday |
Label7: | Ordinal date |
ISO 8601 is an international standard covering the worldwide exchange and communication of date and time-related data. It is maintained by the International Organization for Standardization (ISO) and was first published in 1988, with updates in 1991, 2000, 2004, and 2019, and an amendment in 2022. The standard provides a well-defined, unambiguous method of representing calendar dates and times in worldwide communications, especially to avoid misinterpreting numeric dates and times when such data is transferred between countries with different conventions for writing numeric dates and times.
ISO 8601 applies to these representations and formats: dates, in the Gregorian calendar (including the proleptic Gregorian calendar); times, based on the 24-hour timekeeping system, with optional UTC offset; time intervals; and combinations thereof.[1] The standard does not assign specific meaning to any element of the dates/times represented: the meaning of any element depends on the context of its use. Dates and times represented cannot use words that do not have a specified numerical meaning within the standard (thus excluding names of years in the Chinese calendar), or that do not use computer characters (excludes images or sounds).
In representations that adhere to the ISO 8601 interchange standard, dates and times are arranged such that the greatest temporal term (typically a year) is placed at the left and each successively lesser term is placed to the right of the previous term. Representations must be written in a combination of Arabic numerals and the specific computer characters (such as "", ":", "T", "W", "Z") that are assigned specific meanings within the standard; that is, such commonplace descriptors of dates (or parts of dates) as "January", "Thursday", or "New Year's Day" are not allowed in interchange representations within the standard.
The first edition of the ISO 8601 standard was published as ISO 8601:1988 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. It has been superseded by a second edition ISO 8601:2000 in 2000, by a third edition ISO 8601:2004 published on 1 December 2004, and withdrawn and revised by ISO 8601-1:2019 and ISO 8601-2:2019 on 25 February 2019. ISO 8601 was prepared by,[2] and is under the direct responsibility of, ISO Technical Committee TC 154.[3]
ISO 2014, though superseded, is the standard that originally introduced the all-numeric date notation in most-to-least-significant order . The ISO week numbering system was introduced in ISO 2015, and the identification of days by ordinal dates was originally defined in ISO 2711.
Issued in February 2019,[4] the fourth revision of the standard ISO 8601-1:2019 represents slightly updated contents of the previous ISO 8601:2004 standard,[5] [6] whereas the new ISO 8601-2:2019 defines various extensions such as uncertainties or parts of the Extended Date/Time Format (EDTF).[7] [8] [9] [10] [11] [12]
An amendment was published in October 2022 featuring minor technical clarifications and attempts to remove ambiguities in definitions. The most significant change, however, was the reintroduction of the "24:00:00" format to refer to the instant at the end of a calendar day.
Description | ||
ISO 8601:1988 | Data elements and interchange formats — Information interchange — Representation of dates and times | |
ISO 8601:1988/COR 1:1991 | Data elements and interchange formats — Information interchange — Representation of dates and times — Technical Corrigendum 1 | |
ISO 8601:2000 | Data elements and interchange formats — Information interchange — Representation of dates and times | |
ISO 8601:2004 | Data elements and interchange formats — Information interchange — Representation of dates and times | |
ISO 8601-1:2019 | Date and time — Representations for information interchange — Part 1: Basic rules | |
ISO 8601-2:2019 | Date and time — Representations for information interchange — Part 2: Extensions | |
ISO 8601-1:2019/Amd 1:2022 | Date and time — Representations for information interchange — Part 1: Basic rules — Amendment 1: Technical corrections |
The standard uses the Gregorian calendar, which "serves as an international standard for civil use."[17]
ISO 8601:2004 fixes a reference calendar date to the Gregorian calendar of 20 May 1875 as the date the French: Convention du Mètre (Metre Convention) was signed in Paris (the explicit reference date was removed in ISO 8601-1:2019). 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 15 October 1582.
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).
YYYY | |
±YYYYY |
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.[19] An expanded year representation [±<u>Y</u>YYYY] must have an agreed-upon number of extra year digits beyond the four-digit minimum, and it must be prefixed with a + or − sign[20] instead of the more common AD/BC (or CE/BCE) notation; by convention 1 BC is labelled +0000, 2 BC is labeled −0001, and so on.[21]
or | YYYYMMDD | |
(but not YYYYMM) | ||
Only allowed in the (now superseded) 2000 version:[22] | ||
or | YYMMDD | |
or | -YYMM | |
or | --MMDD | |
Calendar date representations are in the form shown in the adjacent box. [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, "5 April 1981" may be represented as either [13] 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 to mean "1981 April". One may simply write "1981" to refer to that year, or "19" to refer to the century from 1900 to 1999 inclusive. Although the standard allows both the and YYYYMMDD formats for complete calendar date representations, if the day [DD] is omitted then only the format is allowed. By disallowing dates of the form YYYYMM, the standard avoids confusion with the truncated representation YYMMDD (still often used). The 2000 version also allowed writing the truncation to mean "April 5"[23] but the 2004 version does not allow omitting the year when a month is present.
Examples:
See main article: ISO week date.
YYYY-Www | or | YYYYWww | |
YYYY-Www-D | or | YYYYWwwD |
There are several mutually equivalent and compatible descriptions of week 01:
As a consequence, 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 first ISO week of a year may have up to three days that are actually in the Gregorian calendar year that is ending; if three, they are Monday, Tuesday and Wednesday. Similarly, the last ISO week of a year may have up to three days that are actually in the Gregorian calendar year that is starting; if three, they are Friday, Saturday, and Sunday. The Thursday of each ISO week is always in the Gregorian calendar year denoted by the ISO week-numbering year.
Examples:
YYYY-DDD | or | YYYYDDD |
An ordinal date is an ordinal format for the multiples of a day elapsed since the start of year.It is represented as "YYYY-DDD" (or YYYYDDD), where [YYYY] indicates a year and [DDD] is the "day of year", from 001 through 365 (366 in leap years). For example, is the same as .
This simple form is preferable 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. 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 referred to as "Julian Date", but this can cause confusion with the astronomical Julian day, a sequential count of the number of days since day 0 beginning Greenwich noon, Julian proleptic calendar (or noon on ISO date which uses the Gregorian proleptic calendar with a year 0000).
Thh:mm:ss.sss | or | Thhmmss.sss | |
Thh:mm:ss | or | Thhmmss | |
Thh:mm.mmm | or | Thhmm.mmm | |
Thh:mm | or | Thhmm | |
Thh.hhh | |||
Thh | |||
In unambiguous contexts* | |||
hh:mm:ss.sss | or | hhmmss.sss* | |
hh:mm:ss | or | hhmmss* | |
hh:mm | or | hhmm* | |
hh* | |||
|
ISO 8601 uses the 24-hour clock system. As of ISO 8601-1:2019, the basic format is T[hh][mm][ss] and the extended format is T[hh]:[mm]:[ss]. Earlier versions omitted the T (representing time) in both formats.
So a time might appear as either "T134730" in the basic format or "T13:47:30" in the extended format. ISO 8601-1:2019 allows the T to be omitted in the extended format, as in "13:47:30", but only allows the T to be omitted in the basic format when there is no risk of confusion with date expressions.
Either the seconds, or the minutes and seconds, may be omitted from the basic or extended time formats for greater brevity but decreased precision; the resulting reduced precision time formats are:[24]
As of ISO 8601-1:2019/Amd 1:2022, "00:00:00" may be used to refer to midnight corresponding to the instant at the beginning of a calendar day; and "24:00:00" to refer to midnight corresponding to the instant at the end of a calendar day. ISO 8601-1:2019 as originally published removed "24:00:00" as a representation for the end of day although it had been permitted in earlier versions of the standard.
A decimal fraction may be added to the lowest order time element present in any of these representations. A decimal mark, either a comma or a dot on the baseline, is used as a separator between the time element and its fraction. (Following ISO 80000-1 according to ISO 8601:1-2019,[25] it does not stipulate a preference except within International Standards, but with a preference for a comma according to ISO 8601:2004.)For example, to denote "14 hours, 30 and one half minutes", do not include a seconds figure; represent it as "14:30,5", "T1430,5", "14:30.5", or "T1430.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. For example, in Microsoft SQL Server, the precision of a decimal fraction is 3 for a DATETIME, i.e., "yyyy-mm-ddThh:mm:ss[.mmm]".[26]
<time>Z | |
<time>±hh:mm | |
<time>±hhmm | |
<time>±hh |
Time zones in ISO 8601 are represented as local time (with the location unspecified), as UTC, or as an offset from UTC.
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. Even within a single geographic time zone, some local times will be ambiguous if the region observes daylight saving time. It is usually preferable to indicate a time zone (zone designator) using the standard's notation.
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 "T0930Z". "14:45:15 UTC" would be "14:45:15Z" or "T144515Z".
The Z suffix in the ISO 8601 time representation is sometimes referred to as "Zulu time" or "Zulu meridian" because the same letter is used to designate the Zulu time zone.[27] However the ACP 121 standard that defines the list of military time zones makes no mention of UTC and derives the "Zulu time" from the Greenwich Mean Time[28] which was formerly used as the international civil time standard. GMT is no longer precisely defined by the scientific community and can refer to either UTC or UT1 depending on context.[29]
The UTC offset is appended directly to the time instead of "Z" suffix above; other nautical time zone letters are not used. The offset is applied to UTC to get the civil time in the designated time zone in the format '±[hh]:[mm]', '±[hh][mm]', or '±[hh]'.
A negative UTC offset describes a time zone west of the prime meridian where the civil time is behind UTC. So the zone designation for New York (on standard time) would be "-05:00","-0500", or "-05".Conversely, a positive UTC offset describes a time zone east of the prime meridian where the civil time is ahead of UTC. So the zone designation for Cairo will be "+02:00","+0200", or "+02".
A time zone where the civil time coincides with UTC is always designated as positive, though the offset is zero (see related specifications below). So the zone designation for London (on standard time) would be "+00:00", "+0000", or "+00".
See List of UTC offsets for other UTC offsets.
It is not permitted to state a zero value time offset with a negative sign, as "-00:00", "-0000", or "-00". The section dictating sign usage states that a plus sign must be used for a positive or zero value, and a minus sign for a negative value. A plus-minus-sign may also be used if it is available.[30]
Contrary to this rule, RFC 3339, which is otherwise a profile of ISO 8601, permits the use of "-00" with the same denotation as "+00" but a differing connotation: an unknown UTC offset.[31] [32]
To represent a negative offset, ISO 8601 specifies using a minus sign . If the interchange character set is limited and does not have a minus sign character, then the hyphen-minus should be used, .[33] ASCII does not have a minus sign, so its hyphen-minus character (code 4510) would be used. If the character set has a minus sign, such as in Unicode, then that character should be used. The HTML character entity invocation for is &minus;
.
ISO 8601-2:2019 allows for general durations for time offsets. For example, more precision can be added to the time offset with the format '<time>±[hh]:[mm]:[ss].[sss]' or '<time>±[n]H[n]M[n]S' as below.
<date>T<time> |
A single point in time can be represented by concatenating a complete date expression, the letter "T" as a delimiter, and a valid time expression. For example, . In ISO 8601:2004 it was permitted to omit the "T" character by mutual agreement as in,[34] but this provision was removed in ISO 8601-1:2019.Separating date and time parts with other characters such as space is not allowed in ISO 8601, but allowed in its profile RFC 3339.[35]
If a time zone designator is required, it follows the combined date and time. For example, or .
Either basic or extended formats may be used, but both date and time must use the same format. The date expression may be calendar, week, or ordinal, and must use a complete representation. The time may be represented using a specified reduced precision format.
PnYnMnDTnHnMnS | |
PnW | |
P<date>T<time> |
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. However, at least one element must be present, thus "P" is not a valid representation for a duration of 0 seconds. "PT0S" or "P0D", however, are both valid and represent the same duration.
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,[36] 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. But keep in mind that "PT36H" is not the same as "P1DT12H" when switching from or to Daylight saving time.
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 . For example, the first duration shown above would be . 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).[37]
The standard describes a duration as part of time intervals, which are discussed in the next section. The duration format on its own is ambiguous regarding the total number of days in a calendar year and calendar month. The number of seconds in a calendar day is also ambiguous because of leap seconds. For example "P1M" on its own could be 28, 29, 30, or 31 days. There is no ambiguity when used in a time interval. Using example "P2M" duration of two calendar months:
The duration format (or a subset thereof) is widely used independent of time intervals, as with the Java 8 Duration class which supports a subset of the duration format.[38] [39]
There are four ways to express a time interval:
Of these, the first three require two values separated by an interval designator which is usually a solidus (more commonly referred to as a forward slash "/"). Section 3.2.6 of ISO 8601-1:2019 notes that "A solidus may be replaced by a double hyphen ["--"] by mutual agreement of the communicating partners", and previous versions used notations like "2000--2002".[40] Use of a double hyphen instead of a solidus allows inclusion in computer filenames;[41] in common operating systems, a solidus is a reserved character and is not allowed in a filename.
For
If greater precision is desirable to represent the time interval, then more time elements can be added to the representation. An interval denoted can start at any time on and end at any time on, whereas includes the start and end times.To explicitly include all of the start and end dates, the interval would be represented as .
Rn/ | |
R/ |
If the interval specifies the start (forms 1 and 2 above), then this is the start of the repeating interval. If the interval specifies the end but not the start (form 3 above), then this is the end of the repeating interval. For example, to repeat the interval of "P1Y2M10DT2H30M" five times starting at, use .
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 as well as the ambiguous formats YY-MM-DD and YYMMDD. This provision was removed in ISO 8601:2004.
Type | Basic format | Basic example | Extended format | Extended example |
---|---|---|---|---|
A specific date in the implied century | YYMMDD | 851026 | YY-MM-DD | 85-10-26 |
A specific year and month in the implied century | -YYMM | -8510 | -YY-MM | -85-10 |
A specific year in the implied century | -YY | -85 | colspan=2 | |
A specific day of a month in the implied year | --MMDD | --1026 | --MM-DD | --10-26 |
A specific month in the implied year | --MM | --10 | rowspan=2 colspan=2 | |
A specific day in the implied month | ---DD | ---26 | ||
A specific year and ordinal day in the implied century | YYDDD | 85299 | YY-DDD | 85-299 |
A specific ordinal day in the implied year | -DDD | -299 | colspan=2 | |
A specific year and week in the implied decade | -YWww | -5W43 | -Y-Www | -5-W43 |
A specific week and day in the implied year | -WwwD | -W436 | -Www-D | -W43-6 |
A specific day in the implied week | -W-D | -W-6 | colspan=2 | |
A specific minute and second of the implied hour | -mmss | -3456 | -mm:ss | -34:56 |
A specific second of the implied minute | -ss | -56 | colspan=2 | |
A specific minute and decimal fraction of the implied hour | -mm,m | -34,9 |
The first and seventh examples given above omit the leading -
for century. Other formats have one leading -
per omitted century, year, month, week, hour and minute as necessary to disambiguate the format.
ISO 8601-2:2019 defines a set of standardised extensions to the ISO 8601 date and time formats.
The EDTF features are described in the "Date and Time Extensions" section of ISO 8601-2:2019.
On the Internet, the World Wide Web Consortium (W3C) uses the IETF standard based on ISO 8601 in defining a profile of the standard that restricts the supported date and time formats to reduce the chance of error and the complexity of software. The very simple specification is based on a draft of the RFC 3339 mentioned below.[42]
ISO 8601 is referenced by several specifications, but the full range of options of ISO 8601 is not always used. For example, the various electronic program guide standards for TV, digital radio, etc. use several forms to describe points in time and durations. The ID3 audio meta-data specification also makes use of a subset of ISO 8601.[43] The X.690 encoding standard's GeneralizedTime makes use of another subset of ISO 8601.
As of 2006, the ISO week date appears in its basic form on major brand commercial packaging in the United States. Its appearance depended on the particular packaging, canning, or bottling plant more than any particular brand. The format is particularly useful for quality assurance, so that production errors can be readily traced.
IETF RFC 3339[44] defines a profile of ISO 8601 for use in Internet protocols and standards. It explicitly excludes durations and dates before the common era. The more complex formats such as week numbers and ordinal days are not permitted.[45]
RFC 3339 deviates from ISO 8601 in allowing a zero time zone offset to be specified as "-00:00", which ISO 8601 forbids. RFC 3339 intends "-00:00" to carry the connotation that it is not stating a preferred time zone, whereas the conforming "+00:00" or any non-zero offset connotes that the offset being used is preferred. This convention regarding "-00:00" is derived from earlier RFCs, such as RFC 2822 which uses it for timestamps in email headers.[46] RFC 2822 made no claim that any part of its timestamp format conforms to ISO 8601, and so was free to use this convention without conflict.
Building upon the foundations of RFC 3339, the IETF introduced the Internet Extended Date/Time Format (IXDTF) in RFC 9557.[47] This format extends the timestamp representation to include additional information such as an associated time zone name. The inclusion of time zone names is particularly useful for applications that need to account for events like daylight saving time transitions. Furthermore, IXDTF maintains compatibility with pre-existing syntax for attaching time zone names to timestamps, providing a standardized and flexible approach to timestamp representation on the internet. Example:
1996-12-19T16:39:57-08:00[America/Los_Angeles]
Australia | AS/NZS ISO 8601.1:2021, AS/NZS ISO 8601.2:2021 (replaced AS ISO 8601-2007) | |
---|---|---|
Austria | ÖNORM ISO 8601 (replaced ÖNORM EN 28601) | |
Belgium | NBN EN 28601 (1993) | |
Brazil | NBR 5892:2019 | |
Canada | CAN/CSA-Z234.4-89 (R2007)[48] | |
Colombia | NTC 1034:2014 Source ICONTEC (This standard is identical to ISO 8601:2004) | |
China | GB/T 7408-2005 | |
Czech Republic | ČSN ISO 8601 (replaced ČSN EN 28601) (Obsolete as of 2019. No standard was given in exchange.[49]) | |
Denmark | DS/ISO 8601:2005 (replaced DS/EN 28601) | |
Estonia | EVS 8:2008; EVS-ISO 8601:2011 | |
EN ISO 8601, EN 28601:1992 (cancelled 7 October 2011) | ||
Finland | SFS-EN 28601 | |
France | NF Z69-200; NF EN 28601:1993-06-01 (cancelled) | |
Germany | DIN ISO 8601:2006-09 (replaced DIN EN 28601:1993-02); related: DIN 5008:2011-04 (replaced DIN 5008:2005-05, DIN 5008:2001-11, DIN 5008:1996-05) | |
Greece | ELOT EN 28601 | |
Hungary | MSZ ISO 8601:2003 | |
Iceland | IST EN 28601:1992 (obsolete) | |
IS 7900:2001 | ||
Ireland | IS/EN 28601:1993 | |
Italy | UNI EN 28601 (1993) | |
Japan | JIS X 0301:2002 | |
Korea, Republic of | KS X ISO 8601 | |
Lithuania | LST ISO 8601:2006 (replaced LST ISO 8601:1997) | |
Luxembourg | ITM-EN 28601 | |
Mexico | NMX-CH-150-IMNC-1999[50] | |
Netherlands | NEN ISO 8601, NEN EN 28601 (1994), NEN 2772 | |
New Zealand | AS/NZS ISO 8601.1:2021, AS/NZS ISO 8601.2:2021 | |
Norway | NS-ISO 8601 | |
Poland | PN-EN 28601:2002 (Obsolete as of 2008. No standard was given in exchange.[51]) | |
Portugal | NP EN 28601 | |
Russia | ГОСТ ИСО 8601-2001 (current), ГОСТ 7.64-90 (obsolete) | |
South Africa | SANS 8601:2009[52] | |
Spain | UNE EN 28601:1995 | |
Sweden | SS-ISO 8601-1:2022,[53] contains the official English version of ISO 8601-1:2019. (Approved 2022-05-13, replaces SS-ISO 8601:2011, edition 2) | |
Switzerland | SN ISO 8601:2005-08 (replaced SN-EN 28601:1994) | |
Taiwan | CNS 7648 | |
Thailand | TIS 1111:2535 (1992) | |
Turkey | TS ISO 8601-1 and TS ISO 8601-2 (Accepted from 2021-02-15) | |
Ukraine | ДСТУ ISO 8601:2010 | |
United Kingdom | BS ISO 8601:2004, BS EN 28601 (1989-06-30) | |
United States | ANSI INCITS 30-1997 (R2008) and NIST FIPS PUB 4-2 | |
Vietnam | TCVN 6398-1:1998 |
Implementation overview