International standard date and time notation (2024)

by Markus Kuhn

International Standard ISO 8601 specifies numeric representationsof date and time. This standard notation helps to avoid confusion ininternational communication caused by the many different nationalnotations and increases the portability of computer user interfaces.In addition, these formats have several important advantages forcomputer usage compared to other traditional date and time notations.The time notation described here is already the de-facto standard inalmost all countries and the date notation is becoming increasinglypopular.

Especially authors of Web pages and software engineers whodesign user interfaces, file formats, and communication protocolsshould be familiar with ISO 8601.

Contents: Date, time ofday, time zone, softwarehints.

Date

The international standard date notation is

YYYY-MM-DD

where YYYY is the year in the usual Gregorian calendar, MM is themonth of the year between 01 (January) and 12 (December), and DD isthe day of the month between 01 and 31.

For example, the fourth day of February in the year 1995 is writtenin the standard notation as

1995-02-04

Other commonly used notations are e.g. 2/4/95, 4/2/95, 95/2/4,4.2.1995, 04-FEB-1995, 4-February-1995, and many more. Especially thefirst two examples are dangerous, because as both are used quite oftenin the U.S. and in Great Britain and both can not be distinguished, itis unclear whether 2/4/95 means 1995-04-02 or 1995-02-04. The datenotation 2/4/5 has at least six reasonable interpretations (assumingthat only the twentieth and twenty-first century are reasonablecandidates in our life time).

Advantages of the ISO 8601 standard date notation compared to othercommonly used variants:

  • easily readable and writeable by software (no ‘JAN’, ‘FEB’, ...table necessary)
  • easily comparable and sortable with a trivial stringcomparison
  • language independent
  • can not be confused with other popular date notations
  • consistency with the common 24h time notation system, where thelarger units (hours) are also written in front of the smaller ones(minutes and seconds)
  • strings containing a date followed by a time are also easilycomparable and sortable (e.g. write “1995-02-04 22:45:00”)
  • the notation is short and has constant length, which makes bothkeyboard data entry and table layout easier
  • identical to the Chinese date notation, so the largest culturalgroup (>25%) on this planet is already familiar with it :-)
  • date notations with the order “year, month, day” are in additionalready widely used e.g. in Japan, Korea, Hungary, Sweden, Finland,Denmark, and a few other countries and people in the U.S. are alreadyused to at least the “month, day” order
  • a 4-digit year representation avoids overflow problems after2099-12-31

As dates will look a little bit strange anyway starting with2000-01-01 (e.g. like 1/1/0), it has been suggested that the year 2000is an excellent opportunity to change to the standard datenotation.

ISO 8601 is only specifying numeric notations and does not coverdates and times where words are used in the representation. It is notintended as a replacement for language-dependent worded date notationssuch as “24. Dezember 2001” (German) or “February 4, 1995” (USEnglish). ISO 8601 should however be used to replace notations such as“2/4/95” and “9.30 p.m.”.

Apart from the recommended primary standard notationYYYY-MM-DD, ISO 8601 also specifies a number ofalternative formats for use in applications with special requirements.All of these alternatives can easily and automatically bedistinguished from each other:

The hyphens can be omitted if compactness of the representation ismore important than human readability, for example as in

19950204

If only the month or even only the year is of interest:

1995-02 or 1995

In commercial and industrial applications (delivery times,production plans, etc.), especially in Europe, it is often required torefer to a week of a year. Week 01 of a year is per definition thefirst week that has the Thursday in this year, which is equivalent tothe week that contains the fourth day of January. In other words, thefirst week of a new year is the week that has the majority of its daysin the new year. Week 01 might also contain days from the previousyear and the week before week 01 of a year is the last week (52 or 53)of the previous year even if it contains days from the new year. Aweek starts with Monday (day 1) and ends with Sunday (day 7). Forexample, the first week of the year 1997 lasts from 1996-12-30 to1997-01-05 and can be written in standard notation as

1997-W01 or 1997W01

The week notation can also be extended by a number indicating theday of the week. For example, the day 1996-12-31, which is the Tuesday(day 2) of the first week of 1997, can also be written as

1997-W01-2 or 1997W012

for applications like industrial planning where many things likeshift rotations are organized per week and knowing the week number andthe day of the week is more handy than knowing the day of themonth.

An abbreviated version of the year and week number like

1995W05

is sometimes useful as a compact code printed on a product thatindicates when it has been manufactured.

Note: The ISO standard avoidsexplicitly stating the possible range of week numbers, but this caneasily be deduced from the definition. Possible ISO week numbers arein the range 01 to 53. A year always has a week 52. (There is onehistoric exception: the year in which the Gregorian calendar wasintroduced had less than 365 days and less than 52 weeks.)
Proof: Per definition, the first week of a year isW01 and consequently days before week W01 belong to the previous yearand so there is no week with lower numbers. Considering the highestpossible week number, the worst case is a leap year like 1976 thatstarts with a Thursday, because this keeps the highest possible numberof days of W01 in the previous year, i.e. 3 days. In this case, theSunday of W52 of the worst case year is day number 4+51*7=361 and361-366=5 days of W53 belong still to this year, which guarantees thatin the worst case year day 4 (Thursday) of W53 is not yet in the nextyear, so a week number 53 is possible. For example, the 53 weeks ofthe worst case year 1976 started with 1975-12-29 = 1976-W01-1 andended with 1977-01-02 = 1976-W53-7. On the other hand, considering thelowest number of the last week of a year, the worst case is a non-leapyear like 1999 that starts with a Friday, which ensures that the firstthree days of the year belong to the last week of the previous year.In this case, the Sunday of week 52 would be day number 3+52*7=367,i.e. only the last 367-365=2 days of the W52 reach into the next yearand consequently, even a worst case year like 1999 has a week W52including the days 1999-12-27 to 2000-01-02. q.e.d.

Both day and year are useful units of structuring time, because theposition of the sun on the sky, which influences our lives, isdescribed by them. However the 12 months of a year are of some obscuremystic origin and have no real purpose today except that people areused to having them (they do not even describe the current position ofthe moon). In some applications, a date notation is preferred thatuses only the year and the day of the year between 001 and 365 (366 inleap years). The standard notation for this variant representing theday 1995-02-04 (that is day 035 of the year 1995) is

1995-035 or 1995035

Leap years are years with an additional day YYYY-02-29, where theyear number is a multiple of four with the following exception: If ayear is a multiple of 100, then it is only a leap year if it is also amultiple of 400. For example, 1900 was not a leap year, but 2000 isone.

Time of day

The international standard notation for the time of day is

hh:mm:ss

where hh is the number of complete hours that have passed sincemidnight (00-24), mm is the number of complete minutes that havepassed since the start of the hour (00-59), and ss is the number ofcomplete seconds since the start of the minute (00-60). If the hourvalue is 24, then the minute and second values must be zero.

Note: The value 60 for ss mightsometimes be needed during an inserted leap second in anatomic time scale like Coordinated Universal Time (UTC). A single leapsecond 23:59:60 is inserted into the UTC time scale every few years asannounced by the International EarthRotation Service in Paris, to keep UTC from wandering away morethan 0.9s from the less constant astronomical time scale UT1,which is defined by the actual rotation of the earth. Inpractice you are not very likely to see a clock showing 23:59:60.Most synchronized clocks resynchronize again to UTC some time after aleap second has happened, or they temporarily slow down near the timeof a leap seconds, to avoid any disruption that an out-of-rangetimestamp might otherwise cause.

An example time is

23:59:59

which represents the time one second before midnight.

As with the date notation, the separating colons can also beomitted as in

235959

and the precision can be reduced by omitting the seconds or boththe seconds and minutes as in

23:59, 2359, or23

It is also possible to add fractions of a second after a decimaldot or comma, for instance the time 5.8ms before midnight can bewritten as

23:59:59.9942 or 235959.9942

As every day both starts and ends with midnight, the two notations00:00 and 24:00 are available todistinguish the two midnights that can be associated with one date.This means that the following two notations refer to exactly the samepoint in time:

1995-02-04 24:00 = 1995-02-0500:00

In case an unambiguous representation of time is required, 00:00 isusually the preferred notation for midnight and not 24:00. Digitalclocks display 00:00 and not 24:00.

ISO 8601 does not specify, whether its notations specify a point intime or a time period. This means for example that ISO 8601 does notdefine whether 09:00 refers to the exact end of the ninth hour of theday or the period from 09:00 to 09:01 or anything else. The users ofthe standard must somehow agree on the exact interpretation of thetime notation if this should be of any concern.

If a date and a time are displayed on the same line, then alwayswrite the date in front of the time. If a date and a time value arestored together in a single data field, then ISO 8601 suggests thatthey should be separated by a latin capital letter T, as in19951231T235959.

A remark for readers from the U.S.:

The 24h time notation specified here has already been the de-factostandard all over the world in written language for decades. The onlyexception are a few English speaking countries, where still notationswith hours between 1 and 12 and additions like “a.m.” and “p.m.” arein wide use. The common 24h international standard notation is widelyused now even in England (e.g. at airports, cinemas, bus/traintimetables, etc.). Most other languages do not even have abbreviationslike “a.m.” and “p.m.” and the 12h notation is certainly hardly everused on Continental Europe to write or display a time. Even in theU.S., the military and computer programmers have been using the 24hnotation for a long time.

The old English 12h notation has many disadvantages like:

  • It is longer than the normal 24h notation.
  • It takes somewhat more time for humans to compare two times in 12hnotation.
  • It is not clear, how 00:00, 12:00 and 24:00 are represented. Evenencyclopedias and style manuals contain contradicting descriptions anda common quick fix seems to be to avoid “12:00 a.m./p.m.” altogetherand write “noon”, “midnight”, or “12:01 a.m./p.m.” instead, althoughthe word “midnight” still does not distinguish between 00:00 and 24:00(midnight at the start or end of a given day).
  • It makes people often believe that the next day starts at theoverflow from “12:59 a.m.” to “1:00 a.m.”, which is a common problemnot only when people try to program the timer of VCRs shortly aftermidnight.
  • It is not easily comparable with a string compare operation.
  • It is not immediately clear for the unaware, whether the timebetween “12:00 a.m./p.m.” and “1:00 a.m./p.m.” starts at 00:00 or at12:00, i.e. the English 12h notation is more difficult tounderstand.

Please consider the 12h time to be a relic from the dark ages whenRoman numerals were used, the number zero had not yet been inventedand analog clocks were the only known form of displaying a time.Please avoid using it today, especially in technical applications!Even in the U.S., the widely respected Chicago Manual ofStyle now recommends using the international standard timenotation in publications.

A remark for readers from German speakingcountries:

The German standard DIN 5008, which specifies typographical rulesfor German texts written on typewriters, was updated in 1996-05. Theold German numeric date notations DD.MM.YYYY and DD.MM.YY have beenreplaced by the ISO date notations YYYY-MM-DD and YY-MM-DD. Similarly,the old German time notations hh.mm and hh.mm.ss have been replaced bythe ISO notations hh:mm and hh:mm:ss. Those new notations are now alsomentioned in the latest edition of the Duden. The Germanalphanumeric date notation continues to be for example “3. August1994” or “3. Aug. 1994”. The corresponding Austrian standard hasalready used the ISO 8601 date and time notations before.

ISO 8601 has been adopted as European Standard EN 28601 and istherefore now a valid standard in all EU countries and all conflictingnational standards have been changed accordingly.

Time zone

Without any further additions, a date and time as written above isassumed to be in some local time zone. In order to indicate that atime is measured in Universal Time (UTC),you can append a capital letter Z to a time as in

23:59:59Z or 2359Z

Note: The Z stands for the “zeromeridian”, which goes through Greenwich in London, and it is alsocommonly used in radio communication where it is pronounced “Zulu”(the word for Z in the international radio alphabet). Universal Time(sometimes also called “Zulu Time”) was called Greenwich Mean Time(GMT) before 1972, however this term should no longer be used. Sincethe introduction of an international atomic time scale, almost allexisting civil time zones are now related to UTC, which is slightlydifferent from the old and now unused GMT.]

The strings

+hh:mm, +hhmm, or+hh

can be appended to the local time to indicate that the local timezone used is hh hours and mm minutes ahead of UTC. For time zones westof the zero meridian, which are behind UTC, one of the negativeoffsets

-hh:mm, -hhmm, or-hh

is appended instead, to indicate that the preceding local time ishh hours and mm minutes behind UTC. For example, Central European Time(CET), which is an hour ahead of UTC, is indicated by appending +0100,while U.S./Canadian Eastern Standard Time (EST), which is five hoursbehind UTC, is indicated by appending -0500. Therefore, the followingthree strings all indicate the same point in time (noon UTC):

12:00Z = 13:00+01:00 =0700-0500

There is no international standard that specifies letterabbreviations for civil time zones like CET, EST, etc., and sometimesthe same abbreviation is even used for two very different time zones.In addition, politicians enjoy modifying the rules for civil timezones, especially for daylight saving times, every couple of years, sothe only really reliable way of describing a local time zone is tospecify numerically the difference of that local time to UTC. Betteruse directly UTC as your only time zone, where this is possible, andthen you will not have to worry about time zones and daylight savingtime changes at all.

More information about time zones

Paul Eggert, Arthur Olson, and others maintaina database of allcurrent and many historic time zone changes and daylight saving timealgorithms. It is now available as the IANA Time Zone Database in thetzcode* and tzdata* files. Most Unixtime-zone handling implementations are based on this package.

Some hints on using ISO 8601 in software

The ISO 8601 notation is today the commonly recommended format ofrepresenting date and time as human-readable strings in new plain-textcommunication protocols and file formats. Several standards andprofiles have been derived from ISO 8601, including RFC 3339 and a W3C note on date and timeformats.

The C and POSIX standards define for the strftime() function and the dateutility a notation for defining date and time representations. Hereare some examples, of how they can be used to produce ISO 8601output:

format stringoutput
%Y-%m-%d1999-12-31
%Y-%j1999-365
%G-W%V-%u1999-W52-5
%H:%M:%S23:59:59

Other links about date, time, and calendars

Some other interesting sources of information about date and timeon the Internet are for example the Glossaryof Frequency and Timing Terms and the FAQprovided by NIST,the YahooScience:Measurements and Units:Time link collection, the U.S. Naval Observatory Server, theInternational Earth Rotation Service(IERS) (for time gurus only!), the Network Time Protocol (NTP), the time andcalendar section of the USENET sci.astroFAQ, and the Calendar FAQ.

This was a brief overview of the ISO 8601 standard, which coversonly the most useful notations and includes some additional relatedinformation. The full standard defines in addition a number of moreexotic notations including some for periods of time. The ISO 8601:2004standard (3rd edition) itself can only be ordered on paper or as a PDF file onCD-ROM either via ISO’s web site online or from

International Organization forStandardization
Case postale 56
1, rue de Varembé
CH-1211 Genève 20
Switzerland

phone: +41 22 749 01 11
fax: +41 22 733 34 30
email: sales at isocs.iso.ch

Another summary of ISO 8601 is Jukka Korpela’s pageand there are further related pages listed in the Open Directory.

The committee in charge of ISO 8601 is ISO TC 154 and the editor ofthe second edition ISO 8601:2000 was Louis Visser.

I wish to thank EdwardM. Reingold for developing the fine GNU Emacs calendar functions,as well as Rich Wales, Mark Brader, Paul Eggert, and others in theUSENET discussion groups comp.std.internat, comp.protocols.time.ntp,and sci.astro for valuable comments about this text.

Some media coverage:

  • Jon G. Auerbach, Wall Street Journal, 1999-06-01, page A1.

You might also be interested in the International standardpaper sizes Web page.

International standard date and time notation (1)

Markus Kuhn

created 1995 – last modified 2020-06-16 –http://www.cl.cam.ac.uk/~mgk25/iso-time.html

International standard date and time notation (2024)
Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5838

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.