Help:Dates

From Wikidata
Jump to navigation Jump to search

Wikidata offers a series of properties with datatype time, which allow storage of basic information defining single point in time. Time datatype can be further expanded with custom qualifiers to allow great range of possible time expressions. Adding and querying dates may seem simple, but available precision and changing calendars add complexity.

Model

[edit]

Time datatype

[edit]
See also mw:Wikibase/DataModel/JSON#time

Page Special:ListDatatypes describes time datatype as

Literal data field for a point in time. Given as a date and time with some precision and boundaries. The time is saved internally in the specified calendar model.
  • time – explicit value for point in time, represented as a timestamp resembling ISO 8601, e.g. +2013-01-01T00:00:00Z. The year is always signed and padded to have between 4 and 16 digits.
  • timezone – explicit value as a signed integer. Timezone information as an offset from UTC in minutes.
  • before – explicit integer value for how many units after the given time it could be. The unit is given by the precision.
  • after – explicit integer value for how many units before the given time it could be. The unit is given by the precision.
  • precision – explicit value encoded in a shortint. The numbers have the following meaning: 0 - billion years, 1 - hundred million years, ..., 6 - millennium, 7 - century, 8 - decade, 9 - year, 10 - month, 11 - day, 12 - hour, 13 - minute, 14 - second.
  • calendarmodel – explicit value given as a URI. It identifies the calendar model of the timestamp.

That is an accurate description of the saved structure; however, much of it is not being used at the moment:

  • time field can not be saved with precision higher than a "day".
  • We do not use before and after fields and use qualifiers instead to indicate time period.
  • timezone is also not used the encoding (Z) suggest UTC timezone (the date in London), but general practice on Wikidata is to save dates as reported in literature, which usually means in local timezone.
  • calendar – explicit value defining calendar model. Currently two calendar models are supported: proleptic Gregorian calendar (Q1985727) and proleptic Julian calendar (Q1985786)

For example, the actual data structure of Adam Mickiewicz (Q79822)start time (P580) is

          ["P580"] = table {
            table {
              ["datatype"] = "time",
              ["datavalue"] = table {
                ["type"] = "time",
                ["value"] = table {
                  ["after"] = 0,
                  ["before"] = 0,
                  ["calendarmodel"] = "http://www.wikidata.org/entity/Q1985727",
                  ["precision"] = 9,
                  ["time"] = "+1838-01-01T00:00:00Z",
                  ["timezone"] = 0,
                },
              },
              ["hash"] = "1438e02cdfc7ff91f7e722fbbf09f5ba5dba259b",
              ["property"] = "P580",
              ["snaktype"] = "value",
            },
          }

Precision

[edit]

Below is a table with example time strings for several precision values. The strings can be accessed using Lua commands and are also used by QuickStatements (Q20084080)  View with Reasonator View with SQID.

The user interface interprets precision 7 (100 years) and 6 (1,000 years) using strict historical definitions of those terms, which starts with year ending with 01 and ends with year ending with 00. That might be counterintuitive to some people. When using the precision 7 or 6 it is safer to avoid years with the last digits 00. One option is to use the earliest year that avoids the problem, such as 2001 for the 3rd millennium. Another option is to use a date near the midpoint of the range, such as 1950 for the 20th century.

precision timestamp string meaning comments
11 day +2024-11-14T00:00:00Z today's date
10 month +2024-11-00T00:00:00Z this month
9 year +2024-00-00T00:00:00Z current year
8 decade +2010-00-00T00:00:00Z 2010sdate QS:P,+2010-00-00T00:00:00Z/8 Any date in range 2010-2019 with precision 8 is interpreted as 2010s.
7 century +1801-00-00T00:00:00Z 19th century Any date in range 1801-1900 with precision 7 is interpreted as 19th century. This follows strict historical definition of century as explained in Wikipedia article. This might be counterintuitive to some, especially since it does not overlap with definition of decades. Also in some languages people do not use term like 19th century, but something equivalent to eighteen hundreds (1800s).
6 millennium +1500-00-00T00:00:00Z Second millennium Any date in range 1001-2000 with precision 6 is interpreted as second millennium. As with centuries it might be counterintuitive to some.
4 hundred thousand years -2500000-01-01T00:00:00Z 2,500,000 years BCE Example from 2,500th millennium BC (Q3273066) item.
3 million years -13798000000-01-01T00:00:00Z 13,798 million years BCE Example from inflation (Q273508) item.
0 billion years -5000000000-00-00T00:00:00Z 5 billion years BCE Example from earth formation (Q3748186) item.

Hours, minutes and seconds

[edit]

Precisions higher than 11 (day) are not supported as of 2021. These would be:

precision timestamp string meaning
14 second +2024-11-14T20:21:22Z today at 20:21:22
13 minute +2024-11-14T20:21:00Z today at 8:21 pm
12 hour +2024-11-14T20:00:00Z today at 8 pm

There is a feature request to make this possible at phab:T57755.

Due to glitches in the api, a few values with such precision existed in Wikidata.

A workaround is to use the qualifier located in time zone (P421) together with the qualifier refine date (P4241) (described below) and values such as the items 11 PM (Q44529925), 23:00 (Q55812301) or 23:00:00 (Q95135875). Note the difference in precision of these items: hour, minute, second. A list of minute-precision items is at lists/time of the day.

There was also proposal for a dedicated qualifier (Property proposal/local time).

Properties opening time (P8626) and closing time (P8627) use time items as values as well. There were also some discussions to support one or the other string-based formats for such ranges.

Qualifiers

[edit]

Qualifiers can be used to explain or customize dates that cannot be fully represented by the date model above. The precision of the date being qualified should have a precision that encompasses the range described by the qualifiers, or be set to "unknown value" (["snaktype"] = "somevalue"); you can choose an alternative value type by clicking the icon before the input box.

Example dates and how to save them
Statement Code Example from
circa 500 BCE 500 BC (Q240612)sourcing circumstances (P1480)circa (Q5727902) Pythagoras (Q10261)date of death (P570)
after 741 earliest date (P1319)741 (Q23597) Swanachild (Q291747)date of death (P570)
before 140s latest date (P1326)140s (Q188493) Pius I (Q83198)date of birth (P569)
between 586 and 569 BCE earliest date (P1319)586 BC (Q244859)
latest date (P1326)569 BC (Q244355)
Pythagoras (Q10261)date of birth (P569)
between circa 1600 and circa 1615 earliest date (P1319)1600 (Q6720)
latest date (P1326)1615 (Q6784)
sourcing circumstances (P1480)circa (Q5727902)
Pieter Mulier the Elder (Q217640)date of birth (P569)
from 1384 start time (P580)1384 (Q6347) Mikołaj of Ściborz (Q11780990)floruit (P1317)
until 1515 end time (P582)1515 (Q6208)
from 1405 until 1420 start time (P580)1405 (Q6124)
end time (P582)1420 (Q6209)
Master of Egerton (Q29609)floruit (P1317)
beginning of 11th century 11th century (Q7063)refine date (P4241)beginning of (Q40719727) Paraskeva of the Balkans (Q6967370)date of birth (P569)
middle of 18th century 18th century (Q7015)refine date (P4241)middle of (Q40719748) Zlata of Meglen (Q2512266)date of birth (P569)
end of April 2011 April 2011 (Q276437)refine date (P4241)end of (Q40719766) Hoegaarden 0,0 (Q2198961)inception (P571)
first half of 1900s 1900s (Q36574)refine date (P4241)first half (Q40719687) Monogrammist E. D. (Q40912154)floruit (P1317)
summer of 1693 1693 (Q7689)refine date (P4241)summer (northern hemisphere) (Q40720564) Hieronymus Janssens (Q3135313)date of death (P570)
autumn of 1653 1653 (Q6965)refine date (P4241)autumn (northern hemisphere) (Q40720568) Adriaen van Utrecht (Q367970)date of death (P570)
2:11 pm on 9 December 2019 in UTC+13 December 9, 2019 (Q57350878)refine date (P4241)14:11 (Q55811653)located in time zone (P421)UTC+13:00 (Q7118) 2019 Whakaari / White Island eruption (Q77929275)point in time (P585)

Time qualifiers can also be used to provide more information about almost any statement. Those would be:

Properties

[edit]

Full list of time properties can be found at Special:ListProperties/time.

Each person should have some properties related to lifespan:

Information How to store it Comments
date of birth date of birth (P569) with precision "year" and qualifier determination method or standard (P459)=age for a given year mentioned in source (Q21042816): if a source mentions a person's age in a given year, this can be included this way. If only the birthday of a person is known without the year birthday (P3150) can be used.
date of death date of death (P570) with qualifier latest date (P1326): if a source mentions his widow in a given year, this can be stated with qualifier P1326.
date of baptism date of baptism (P1636) For many people we only know precise date of baptism, not birth. Often year of birth is stored with precise date of baptism.
date of burial or cremation date of burial or cremation (P4602) Similarly to date of baptism, sometimes only precise date of burial is known, which is than used to estimate month or year of death.
date of disappearance date of disappearance (P746) Date or point of time a missing person was seen or otherwise known to be alive for the last time.
alive floruit (P1317) Date when a person was known to be alive. Can help determine if a person born after 1901 is still alive or when a person without date of birth first came into the public eye.
(super-)centenarian significant event (P793)=centenarian (Q2944360)
significant event (P793)=supercentenarian (Q1200828)
Person known to have reached 100/110 years. Can help determine if a person born before 1924 or 1914 is still alive.
work period or period when someone flourished (Latin: floruit or fl.) Two ways to store it: floruit (P1317) means date or period during which a person was known to have been alive or active, which is a little broader meaning than work period, as it might store dates when someone was alive but not active. In practice many people for whom we do not know the lifespan dates, we know only through their work, so those two properties would store the same information. Often floruit (P1317) stores information like 15th century, while work period (start) (P2031) and work period (end) (P2032) would store more precise date range.

Time properties are also used to record significant dates related to artworks, books, buildings and other objects:

Information Property to store it Applies to How to use it
inception inception (P571) artwork
book
map
music
organization
date or point in time when the organization/subject was founded/created
time of discovery time of discovery or invention (P575) artwork
artifact
astronomic objects
inventions
taxons
date when the item was discovered
dissolved, abolished or demolished date dissolved, abolished or demolished date (P576) organization
building
date when an organization was dissolved/disappeared or a building demolished
publication date publication date (P577) book
map
music
date or point in time a work is first published or released
first performance date of first performance (P1191) work
music
date a work was first debuted, performed or broadcasted
time of earliest written record time of earliest written record (P1249)
discontinued date discontinued date (P2669) products date that the availability of a product was discontinued
production date production date (P2754) date of production of a creative work, if different from the publication date
date depicted date depicted (P2913) artwork
book
map
date depicted in a work
public domain date public domain date (P3893) artworks
books
date the item enters into the public domain in a jurisdiction
date of official opening date of official opening (P1619) building
event
date an event, institution, or building opened
date of official closure date of official closure (P3999) building
event
date of official closure of a building or event
service entry service entry (P729) vehicle
equipment
date when a piece or class of equipment entered operational service
service retirement service retirement (P730) vehicle
equipment
date when a piece or class of equipment was retired from operational service
year of publication of scientific name for taxon year of publication of scientific name for taxon (P574) taxon date when a scientific name was formally established. Together with taxon author (P405) used as qualifier of taxon name (P225).
UTC date of spacecraft launch UTC date of spacecraft launch (P619) spacecraft
UTC date of spacecraft landing UTC date of spacecraft landing (P620) spacecraft
time of object orbit decay time of object orbit decay (P621) spacecraft
spacecraft docking/undocking date spacecraft docking/undocking date (P622) spacecraft
periapsis date (DEPRECATED) periapsis date (DEPRECATED) (P2285) astronomical object time for perihelion/perigee in each orbit for an astronomical object

Recurring dates

[edit]

For yearly recurring events there is day in year for periodic occurrence (P837), a special example is birthday (P3150). Help:Easter related dates helps with finding items for recurring days defined by their distance to Easter.

Property pairs for time periods

[edit]
from to
inception (P571): time when an entity begins to exist; for date of official opening use P1619 dissolved, abolished or demolished date (P576): point in time at which the subject (organisation, building) ceased to exist; see "date of official closure" (P3999) for closing a facility, "service retirement" (P730) for retiring equipment, "discontinued date" (P2669) for stopping a product
discontinued date (P2669): date that the availability of a product or service was discontinued; see also "dissolved, abolished or demolished" (P576) and "service retirement" (P730) for pieces or classes of equipment
service retirement (P730): date or point in time on which a piece or class of equipment was retired from operational service ; use P2669 for end of a public service
date of official closure (P3999): date of official closure of a building or event
date of official opening (P1619): date or point in time an event, museum, theater etc. officially opened date of official closure (P3999): date of official closure of a building or event
service entry (P729): date or point in time on which a piece or class of equipment entered operational service service retirement (P730): date or point in time on which a piece or class of equipment was retired from operational service ; use P2669 for end of a public service
date of commercialization (P5204): date when a product was first commercialized discontinued date (P2669): date that the availability of a product or service was discontinued; see also "dissolved, abolished or demolished" (P576) and "service retirement" (P730) for pieces or classes of equipment
start time (P580): time an entity begins to exist or a statement starts being valid end time (P582): moment when an entity ceases to exist or a statement stops being valid
work period (start) (P2031): start of period during which a person or group flourished (fl. = "floruit") in their professional activity work period (end) (P2032): end of period during which a person or group flourished (fl. = "floruit") in their professional activity
start period (P3415): initial period in which the statement is valid (including the period-value) end period (P3416): last period in which the statement is still valid (including the period-value)
open period from (P3027): qualifier to P3025 (open days) for season when open days apply open period to (P3028): qualifier to P3025 (open days) for season when open days apply
start of covered period (P7103): start of period covered by an archive set, a historical book, or a collection end of covered period (P7104): end of period covered by an archive set, a historical book, or a collection
minimum date (property constraint) (P2310): qualifier to define a property constraint in combination with "property constraint" (P2302) maximum date (property constraint) (P2311): qualifier to define a property constraint in combination with "property constraint" (P2302). Use "unknown value" for current date.
date of the first one (P7124): qualifier: when the first element of a quantity appeared/took place date of the latest one (P7125): qualifier: when the latest element of a quantity appeared/took place
date of birth (P569): date on which the subject was born date of death (P570): date on which the subject died
date of baptism (P1636): date when a person was baptized. For times when only baptism records were available, this can be a good substitute for date of birth.

Interface

[edit]

Entry of exact dates

[edit]

When a date in 2024 is entered, e.g. 2024-11-14, the calendar model is set by default to proleptic Gregorian calendar (Q1985727).

For current dates, this works fine.

For earlier dates, the applicable calendar should be determined:

  • The Gregorian calendar was first introduced in 1582 replacing the Julian calendar.
  • The last countries to convert from the Julian to the Gregorian calendar did so in the 1920s. → w:Adoption of the Gregorian calendar.

Depending on the country and the source at hand, the applicable calendar has to be determined and entered.

If it can't be determined if the date is in one or the other calendar, that date should be entered in the default calendar with the qualifier sourcing circumstances (P1480) = unspecified calendar (Q18195782).

Some countries did use or still use other calendars. None of these are supported. Dates need to be converted to Julian or Gregorian.

Inexact dates

[edit]

In quite a few cases the exact date of an event (like a date of birth) is not known. We have several approaches depending on how the source documents it.

End of automatically generated list.
Precision

The first approach is to change the precision. For example when the source says 1620s:

  1. Add a date claim
  2. Enter a year (for example 1625)
  3. Click "advanced adjustments"
  4. Change the precision to something suitable (for example a decade)
  5. Add the source
  6. Save the statement
Qualifiers for earliest/latest

The first approach can be expanded if you know a before and/or after date. For example when the source says before 1625:

  1. Add the statement as above, but don't save it yet
  2. Add a qualifier latest date (P1326) and/or earliest date (P1319) with the date
  3. Save the statement
Qualifier for circa

The second approach is suitable if the source says around a certain date or year. For example "around 1622":

  1. Add a date claim with a certain date
  2. Enter the year (for example 1622)
  3. Add qualifier sourcing circumstances (P1480) -> circa (Q5727902)
  4. Add the source
  5. Save the statement

Years BC

[edit]
  • Years BC should be entered as is.
Sample: Year 458 BC on Q309637#P39 is entered as "458 BCE" and appears as "458 BCE".
  • For RDF export (e.g. on Wikidata Query Service) the following applies: "The dates follow XSD 1.1 standard, i.e. 1 BCE is year 0."[1]. Year "0" is also exported as year 0, but only if it is Julian calendar, because non-Gregorian dates are passed through as is. Year 0 Gregorian is invalid in the database would not be exported. Year 2 BCE, as -1.
Sample: Year 458 BC on https://www.wikidata.org/wiki/Special:EntityData/Q309637.rdf appears as "<pq:P585 rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">-0457-01-01T00:00:00Z</pq:P585>". The same is visible on the below SPARQL query.
SELECT *
{
	VALUES ?item { wd:Q309637 }
  	?item p:P39 ?p1 . ?p1 pqv:P585 ?p3 . ?p3 ?p4 ?p5
}
LIMIT 100
Try it!
  • For RDF export (e.g. on Wikidata Query Service), dates BC (as any dates) are converted to Gregorian dates.
Sample: 27 November 8 BCE appears as "-0007-11-25T00:00:00Z"
  • For JSON export the format is inspired by XSD 1.0 and ISO 8601:1988. The year 0 is undefined, 1 BCE is exported as -0001, 2 BCE is exported as -0002, etc.

Filter dates inside sparql queries

[edit]

Examples of syntax:

Use cases for query on dates
Use case Sparql
Any event that occurred between year X and year Y
SELECT ?item ?itemLabel ?time
WHERE
{
  ?item wdt:P585 ?time.
  FILTER (   YEAR(?time) > 1450 && YEAR(?time) < 1454  ).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!
Any event that occurred between a date X and a date Y
SELECT ?item ?itemLabel ?time
WHERE
{
  ?item wdt:P585 ?time.
  FILTER ((?time > "1452-01-01"^^xsd:dateTime) && (?time < "1452-12-31"^^xsd:dateTime)).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!
Any event that happened on a specific date
SELECT ?item ?itemLabel
WHERE
{
  ?item wdt:P585 "+1789-07-14T00:00:00Z"^^xsd:dateTime.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!
People born in 1700 with day or month precision dates
SELECT ?item ?itemLabel ?time ?precision
WHERE
{
  VALUES ?precision { 10 11 }#10 = month precision, 11 = day precision
  ?item p:P569/psv:P569 [wikibase:timePrecision ?precision; wikibase:timeValue ?time].
  FILTER (   YEAR(?time) = 1700 ).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} 
LIMIT 10
Try it!

January 1 as date

[edit]

Some dates from date of birth (P569):

rank January 1 January 2 January 3
Normal rank 21946 10842 10811
Preferred rank 284 151 153
Deprecated rank 1649 6 8
23879 10999 10972
as of 2022-02-02
Query

A January 1 date of birth (P569) can occur for several reasons:

  • (A) a person was born on January 1
  • (B) a person's birth was registered as being on January 1
  • (C) a person's exact date of birth is unknown, but was officially registered with the year and "January 1"
  • (D) a database stores year precision dates with "January 1"
  • (E) a conversion between some database and Wikidata led to the year of birth added as January 1 of that year.

Wikidata would generally include (A), (B), (C) with the appropriate reference and rank. (D) would generally be stored with deprecated rank or year precision. (E) should be corrected by changing the date precision to year.

Similar problems can be found with other dates, e.g. date of death (P570).

Known issues

[edit]

See Phab:T87764 (Bugs related to time datatype (tracking))

  • In 2015, the format for dates was changed. Julian dates entered before are likely to be off a few days.
  • Some dates may have year precision, but have been entered as day precision
  • The documentation indicates the time zone exists, but the only time zone that can be entered is an offset of 0 from w:universal time. Since it is impossible to capture the time zone of the source, most of the dates in Wikipedia are, strictly speaking, false.
  • See Phab:T95553. The user interface accepts and presents dates with precision 7 (100 years) strangely, enticing editors to enter incorrect dates.

See also

[edit]

Notes

[edit]
  1. mw:Wikibase/Indexing/RDF_Dump_Format#Time