Date specification

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Date specification
· Afrikaans · Alemannisch · aragonés · asturianu · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Bân-lâm-gú · Basa Jawa · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · Kurdî · latviešu · Lëtzebuergesch · lietuvių · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk bokmål · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · भोजपुरी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ‎ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް

Openstreetmap uses a subset of the ISO 8601 standard for single dates, and in most cases a simplified (not ISO 8601 compatible) notation for year ranges.

Single date

In the simplest case the date is a four digit year ("YYYY") or full date as ("YYYY-MM-DD")

Examples:

  • "1984"
  • "1984-03-27"

Date ranges

In most cases the format "YYYY-YYYY" (such as "1964-1986") is used and allows only the specification years.

To avoid parsing ambiguities and allow easier filtering of tags, please use unabbreviated formats, with fixed number of digits, i.e. with leading zeroes if necessary for day and month numbers, and use hyphens between each date component.

If a range defined by full dates should be specified, a double hyphen ("--") could be used as date separator - eg "1964-01-28--1986-03-17" or "1965--1986-03-17". However this is not necessary when the ending date starts by a year on 4 digits (so "1964-01-28-1986-03-17" is also valid and unambiguous), or when the starting and ending date are missing (in which case a single hyphen starting or ending the value means a data range).

Examples:

  • "-1964" - until 1964, alternative and rarely used form "--1964"
  • "1964-" - from 1964 and still valid, alternative and rarely used form "1964--"
  • "1964-1986" - years 1964-1986, alternative form "1964--1986"
  • "1964-01-28-1986-03-17" - alternative form "1964-01-28--1986-03-17"
  • "1965-1986-03-17" - alternative form "1965--1986-03-17"

The double hyphen may be necessary only for date ranges omitting years (but those dates are not in ISO 8601 format, which requires the leading 4-digit year). (Note that ISO 8601 use a slash "/" for the separator in date ranges, but still requires the year; older versions of ISO 8601 also allowed partial dates without year but used "--" to replace the omitted year).

Examples:

  • "01--03" - from start of January to end of March (in any year)
  • "01-03" - 3 January only (in any year)
  • "01-01--01-15" - from 01 January to 15 January (in any year)
  • "01-01-01-15" - ambiguous parsing, don't use.

Uses in Openstreetmap

Date namespace

The date namespace can be used to map history of features.

  • example "building:1910--1955=school" + "building:1955--=house" (rarely used form with double hyphen, that conflicts with older version of ISO 8601)
  • example "building:1910-1955=school" + "building:1955-=house" (most common form using single hyphen)

Key:opening_date

See opening_date=*

Software considerations

In places where single dates are expected normal ISO 8601 parsing routines should yield correct results.

In places where date ranges are expected the software could check for the simplified single hyphen notation and then fall back to ISO 8601 parsing of date ranges.

See also