© Crown copyright 2020
This publication is licensed under the terms of the Open Government Licence v3.0 except where otherwise stated. To view this licence, visit nationalarchives.gov.uk/doc/open-government-licence/version/3 or write to the Information Policy Team, The National Archives, Kew, London TW9 4DU, or email: firstname.lastname@example.org.
Where we have identified any third party copyright information you will need to obtain permission from the copyright holders concerned.
This publication is available at https://www.gov.uk/government/publications/open-standards-for-government/date-times-and-time-stamps-standard
Use ISO 8601:2004 to represent dates and times in a machine-readable format in government systems.
1. Summary of the standard’s use for government
Use the ISO 8601 standard for machine-readable dates and times in:
- data for transferring between systems
- date sorting, for example at the start of filenames
This standard does not apply when human readability is the main concern. For example, dates and times added within the text of a document. The GOV.UK Design System has guidance on using dates in digital services.
This profile uses the 2004 version of the standard as it still meets the government’s needs.
2. How this standard meets user needs
Users of this standard include:
- publishers of government data
- data scientists
- data analysts
Using the ISO 8601 standard means you’ll have:
- more consistency in how your systems format data
- the flexibility to choose how precise you make the date and time
- an easier way to sort documents by date and filename
- improved ability to exchange data internationally, without issues with time zones and date formats
The ISO standard documentation and its BSI equivalent are not free of charge. There are other profiles available for this standard which are free of charge including:
- the IETF RFC 3339
- the W3C date and time format note
- other independent published guidance that summarises the standard
3. How to use the standard
Use the ISO 8601 format to the level of accuracy you need when you’re recording or exchanging a date, or date and time, in a system. The minimum level of accuracy for this standard is four digits representing a year.
List date and time elements in descending order of size (years, months, days, hours, minutes, seconds, milliseconds and microseconds). If you’re using ‘time’, separate it from the ‘date’ with ‘T’, use the 24-hour format and a colon to separate hours and minutes. You can also separate each value with hyphens to increase readability. For example, YYYY-MM-DD-THH:MM-SS. You can refer to midnight as either 00:00 or 24:00 so your documentation should be clear whether you’re referring to the start or end of the day.
This profile assumes that you’re using local time. You can add a Coordinated Universal Time (UTC) offset. For example, 2017-05-16T10:30:56+01:00 is 16 May 2017 10:30 and 56 seconds with an offset showing British summer time (BST), one hour ahead of UTC.
ISO 8601 is also compatible with other date standards such as:
- RFC 3339, which simplifies ISO 8601 for use in internet protocols by leaving out infrequently used levels of accuracy
- W3C date and time format, which is an ISO 8601 profile written to simplify its use in WWW standards
ISO 8601 is also used in the following open standards for government:
- Exchange of calendar events - iCAL
- Exchange of contact information - vCard
- Sharing or collaborating with government documents - ODF 1.2
- Open contracting data - OCDS
- Publishing international development data - IATI
- Publishing job vacancies - JobPosting
- Share information between emergency services with MAIT
- Publishing government documents HTML5