Coders: use ISO8601 for dates and time

By , ITworld |  Software, development, ISO8601

Time can take a variety of differnet shapes.

Source: ChrisL_AK/Flickr

Exchanging dates between computer systems is tough, but it doesn't have to be if you follow ISO8601.

Officially, ISO8601 is an international standard for exchanging date and time information that appeared first in 1988. The latest update was in 2004. ISO8601 says dates should be presented in the format of YYYY-MM-DD, which is not the way most Americans do their dates. Time follows the format of HH-MM-SS, with more precise parts of seconds following if needed.

The format for dates is human readable, always a plus. Time zones, or officially offsets from UTC or Coordinated Universal Time, (which replaced the term Greenwich Mean Time), are supported. Also supported is enough flexibility to let some coders do strange things, like making 2009-09-09T09:09:09.00000000000000000009 a valid time. Of course, if you're slicing seconds into that many small pieces, you need a good way to transmit that information. ISO8601 does work, even for crazy times.

Love for 8601

Been a big fan of 8601 for years. It's very precise and promises to save the rest of the world from the insanity that is the USA date format.
Simon on tempus-js.com

ISO8601 allows you to decanonicalize your timestamps into various timezones, which is a bit hairy.
phyzome on reddit.com

ISO 8601 tries to cover most cases for date/time representation.
lifthrasiir on news.ycombinator.com

Meh

I've used ISO8601 in various webapps in the past, and eventually came to the conclusion that they provide almost no benefit, beyond human readability.
dwdwdw2 on reddit.com

I don't understand why you would ever use anything other than seconds/micros/millis since epoch.
aidenn0 on news.ycombinator.com

Coders argue

I just use momentjs which has basically the same api, is 4.3k minified and has tons of localization.
lookfirst on tempus-js.com

You can pry my "seconds since the epoch" timestamps from my cold dead hands.
metabrew on news.ycombinator.com

Also, it's strongly advisable to convert all incoming dates to a consistent time zone for internal usage.
Neebat on reddit.com

What is all this "Human Readable" nonsense. Who the hell is reading all these date times?
tomelders on news.ycombinator.com

Coders, speak up: do you follow ISO8601?

For the latest IT news, analysis and how-tos, follow ITworld on Twitter, Facebook, and Google+.

Now read this:
Developer declares 'I am done with the Freemium Business Model'
Khan Academy offers JavaScript as their first computer language
Study says Facebook profile can predict job performance

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question