Skip to main content

https://technology.blog.gov.uk/2018/01/31/its-time-to-use-iso-8601-across-government/

It’s time to use ISO 8601 across government

Posted by: , Posted on: - Categories: Transformation
Image credit: © UK Parliament/ Mark Duffy

The Open Standards Board has issued date-times and time-stamps guidance mandating the use of the ISO 8601 standard on UK government IT systems.  

ISO 8601 displays dates and times in order of increasing accuracy. For example, the stamp 2017-01-25T12:34:56+00:00 tells us the:

  • the year (2017)
  • month (January)
  • date (25th)
  • time (12:34pm and 56 seconds)
  • time zone (+00:00, which is Greenwich Mean Time)

When you should use ISO 8601

The date-times and time-stamps guidance mandates using the ISO 8601 when you want to show date and time within:

  • API responses
  • metadata in documents
  • internal document titles
  • any other machine-to-machine communication

The Open Standards Board mandates using ISO 8601 for use where it’s relevant because user research found 2 limitations. We recommend the standard is best suited for machine-to-machine communication, at present.

Here are a couple of examples of the limitations we found.

A local council may send a resident a text message let them know the date of their rubbish collection. The ideal message will include the day of collection, such as ‘Thursday’. However, ISO 8601 does not cover names of days.

Secondly, people can find it hard to read an 8601 string if they are unfamiliar with it. The NHS told us that labels on medicines should conform to the NHS Common User Interface Design Guidelines and take the form 01-JAN-2017. This format displays all the relevant information and is easier to read than the ISO 8601 string.

Why ISO 8601 is mandated

There are many ways to write the time. We found a government document with the stamp - 170356Z JULY 03. This stamp tells us the document was a telegram sent on the 16th of July 2003 at 11:56pm. You’ll struggle to decipher this unless you’re familiar with the ACP 121 standard.

Even dates written in the form 01/02/2015 can present a problem. Is this the first of February, or the second of January? American and European readers will have a different answer. What about the time 1510924348? That's the number of seconds since the start of 1970.

We've chosen ISO 8601 because it’s a worldwide standard all modern programming languages support. ISO 8601 provides high precision, is timezone aware and is easy for humans to understand. It's also used by NASA, (which will be useful if GDS goes into space!)

Using ISO 8601 will help us increase precision, reduce ambiguity, and make it easier to compare different dates.

Is ISO 8601 an open standard?

Sadly, ISO 8601 doesn't meet our definition of an open standard as it’s locked behind a paywall. You need to pay around £100 if you want to read the official version of how to implement the standard instead of the Wikipedia entry.

We're currently in discussions with ISO about how we can make the standard open as payment restrictions should not apply to core internet technology standards.

Overall, we’ve decided the benefits of ISO 8601 still outweigh the negatives. ISO 8601 is universal - many of the standards we mandate refer to ISO 8601, every programming language we use has an ISO 8601 aware time library, and there are many reference implementations freely available.

We're going to do our best to open the standard up and we'll let you know how we get on.

Get involved

If you want to help us select future open standards, then please get involved on our GitHub page.

Sharing and comments

Share this page

5 comments

  1. Comment by Sam Sharpe posted on

    > This stamp tells us the document was a telegram sent on the 16th of July 2003 at 11:56pm

    So this was really interesting to me, because I'd never seen the standard. However when I read it, I saw that the format was DDHHMM(X)MMMYY so technically that document was sent on the 17th of July 2003 at 3:56am GMT.

    So it's only "sent on the 16th of July 2003 at 11:56pm" if it was sent from GMT-4 (Barbados, British Virgin Islands etc) so for the sake of clarity, you should probably add a timezone in your human readable description.

  2. Comment by James Sibbald posted on

    In the example of which you state is ACP 121, namely "We found a government document with the stamp - 170356Z JULY 03. This stamp tells us the document was a telegram sent on the 16th of July 2003 at 11:56pm." you are deciphering it wrongly. The Z relates to Greenwich Mean Time so the correct Date Time Group (DTG) should read as 17th of July 2003 at 3:56am Greenwich Mean Time, Your example would relate to a time possibly local to Washington DC.

  3. Comment by Frankie Roberto posted on

    Good luck with persuading the ISO to release it as an open standard! That would be an excellent outcome, especially as it is already de facto open.

  4. Comment by Terence Eden posted on

    Hi Sam and James. In the example we used, the official document related to a telegram sent from Washington DC - hence it being the 16th. At that specific date, the UK is on UTC+1 and Washington DC is UTC-4.

    Interestingly, the official specification says that months should be written as MMM. That is JUL rather than JULY. So the datestamp as used is both confusing and incorrect!

    The hope is that by using ISO8601 in metadata we can make things easier to understand.

    Thanks for your comments.

  5. Comment by Jeff Hurst posted on

    Meet in the Middle. Consider explicit date formats
    Info@ http://www.1World1Date1Day.Link
    #yyyy0MMdd 2018-002-03
    #dd0MMyyyy 03.002.2018
    #0MMddyyyy 002/03/2018

    #1World1Date1Day
    #1Mundo1Fecha1Día
    #1个世界1日期1天
    #1Welt1Datum1Tag
    #1Monde1Date1Jour
    #1年1月1日
    #1Світ1дата1день
    #1세계1날짜1일
    #1Mondo1Data1Giorno
    #1Värld1Datum1Dag
    1 العالم 1 التاريخ 1 يوم#
    #1Мир1Дата1день