iso-8601: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
m (Reverted edits by [[Special:Contributions/000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
(add FAQ, move resolved issues to separate page)
Line 25: Line 25:


__TOC__
__TOC__
== HTML5 ==
[[HTML5]] uses both a subset of ISO 8601 for dates, times, durations for the <code>&lt;time&gt;</code> element, as well as an extended (and more human friendly) duration format.
==<nowiki>RFC 3339</nowiki>==
==<nowiki>RFC 3339</nowiki>==


Line 39: Line 42:


{{ToDo}} document more implementations.
{{ToDo}} document more implementations.
== FAQ ==
=== Why hyphens in dates ===
Q: Must I use the hyphens?[https://twitter.com/edburns/status/368063860835897344]
A: You <em>should</em> always use hyphens in ISO 8601 dates because that makes them more readable, and thus more human friendly.
Also, using hyphens helps clearly distinguish different uses for different granularities of dates, e.g.:
* 2013-08-19 - just the day
* 2013-08 - the whole month
* 2013 - the entire year


==Issues==
==Issues==
* How should dates before the common era be marked up? [[User:AndyMabbett|Andy Mabbett]]
None currently.
** What are the use-cases? Link to *-examples page? - [[User:Tantek|Tantek]]
 
* If a web page is created or edited by a non-technical human, it is unfriendly to expect them to work in ISO date format. [[User:CharlesBelov|Charles Belov]]
Resolved issues: [[iso-8601-issues-resolved]].
** ISO dates are more readable/usable by people globally than any one locale-specific format, thus it is more friendly globally to use and ask humans to edit ISO 8601 dates than asking them to try to read/write all the odd and quirky locale-specific formats. - [[User:Tantek|Tantek]]


==See also==
==See also==

Revision as of 19:50, 19 August 2013

<entry-title>ISO 8601</entry-title>

The International Standards Organisation's standard, number 8601 is an international standard for date and time representations. It is used for all date-time representations in microformats, as well as a number of other formats (HTML5 <time> element & datetime attribute, XML Schema Datatypes, RDF, Atom).

iso_8601.png

Image: XKCD

In addition, ISO 8601 dates in particular are the most globally unambiguously human readable/writeable date format and thus should always be used on the (world wide) web.

Overview

The following are good prose overviews of ISO 8601:

Microformats

microformats in general use a subset of ISO8601 - preferring uses which are more human readable (requiring hyphens in dates, and colons in times).

All date-time properties in microformats use ISO8601 values. E.g.

HTML5

HTML5 uses both a subset of ISO 8601 for dates, times, durations for the <time> element, as well as an extended (and more human friendly) duration format.

RFC 3339

RFC 3339 defines a profile of ISO 8601 for the use in Internet protocols and standards.

  • It explicitly excludes durations and dates before the common era.
  • The more complex formats like week numbers and ordinal day are not permitted (see RFC 3339, section 5.6).

ISO 8601 implementations in programming libraries

  • JodaTime - the Java date-time library - ISO8601 Java calendar system
  • Perl: DateTime::Format::ISO8601
  • Ruby 1.9 implements an iso8601 method in the Date STDLIB but it does not handle ordinal dates.
  • Glenn Jones' microformat-node parser includes isodate.js, a Node.js implementation of (some of) ISO 8601.

to do! document more implementations.

FAQ

Why hyphens in dates

Q: Must I use the hyphens?[1]

A: You should always use hyphens in ISO 8601 dates because that makes them more readable, and thus more human friendly.

Also, using hyphens helps clearly distinguish different uses for different granularities of dates, e.g.:

  • 2013-08-19 - just the day
  • 2013-08 - the whole month
  • 2013 - the entire year

Issues

None currently.

Resolved issues: iso-8601-issues-resolved.

See also

Related pages