|Holds particular points in time|
|Provided by:||Semantic MediaWiki|
|Added in version:||1.4.0|
|Removed in version:||still in use|
|In this wiki:||Date|
|Table of Contents|
The datatype Date is used for data values that represent points in time. It is able to support dates throughout human history in a unified format, and it offers internationalisation options for supporting more languages. All dates and times refer to the "local time" of the server (or the wiki). A wiki may define what timezone this refers to by common conventions. For export, times are given without timezone information. However, time offsets to that local time are supported.
Examples of typical input dates in English language are:
- Feb 11 2000 10:00:01 (complete date with time)
- Feb 11 2000 (just date)
- 2000 (just year)
- Feb 11 2000 10:00:01 PM (complete date with time, PM)
- Feb 11 2000 22:00:01 (complete date with 24h time)
- 2000-02-11T22:00:01 (ISO-style date)
- 2000-02-11T22:00:01+02:00 (ISO-style date with offset)
- 2000 February 2 (varying order of inputs is supported)
- 2-3-2000 (preferred interpretation, month or day, sometimes depends on language settings)
- 2/3/2000 (various kinds of separators are recognized in all languages)
- Jan 1 300 BC (dates BC/before common era are supported)
- 14000000000 BC (estimated age of the universe)
- Feb 11 2000 Jl (date of the Julian Calendar)
- Feb 11 1492 Gr (date is treated as Gregorian)
- Feb 11 2000 10:00 GMT (date with time zone shortcut)
- 2000-02-22 (MySQL date format)
- 1999-00-00"1999-00-00" contains a sequence that could not be interpreted against an available match matrix for date components. (MySQL partial date format)
- Sun Jun 20 23:21:05 1993
Other languages may also support additional strings as month names, and they may choose different preferred interpretations of ambiguous dates. The basic format, however, is the same.
Dates are displayed in a simple format that cannot be changed with the language setting in the user preferences. Month names in displayed dates are just translated based on the wiki's current language (if translated names are available). User settings are not taken into account for displaying dates. Starting with version 1.7.0 of Semantic MediaWiki you can also use "#MEDIAWIKI" behind the printout request to use the MediaWiki's i18n methods for time and date formatting. It has superior i18n support, but cannot handle all possible values, since MediaWiki's formatting extends only to a very restricted range of dates, typically between 1901-12-14 and 2038-01-19. Note that this format is colligated with the wiki's language set in LocalSettings.php with
In case you want to keep the simple format in printout request of queries (Inline queries or Concepts) you may use "#ISO" behind the printout requests of this type. Thus instead of displaying "Jan 9 2008" (achieved with printout request
?birthday) you will get "2008-01-09" (achieved with printout request
?birthday#ISO) which is a plain format representing an ISO formatted international date string.
Display takes into account if parts of a date were omitted. So a date specified as "2008" will also be printed as "2008" everywhere, even though it might be interpreted as "Jan 1 2008 00:00:00" when comparing it to other dates.
Handling of incomplete dates
The implementation notices and stores whether parts of a date/time have been omitted (as in "2008" or "May 2007"). For all exporting and sorting purposes, incomplete dates are completed with defaults (usually using the earliest possible time, i.e. interpreting "2008" as "Jan 1 2008 00:00:00"). But the information on what was unspecified is kept internally for improving behaviour e.g. for outputs (defaults are not printed when querying for a value).
Only the minor parts of a date can be omitted: "May 2008" works, but "May 1" does not. This is so, since the latter could not be given a sensible default interpretation when sorting dates. To support sorting and querying, all dates must be interpretable as a concrete precise time point, and this is done internally when required, even for incomplete dates.
At the moment, Type:Date supports two calendar models: Gregorian and Julian In 1582 the Catholic Church introduced a reform of the calendar Julian calendar. So dates before 24. Februar 1582 are supposed to refer to Julian calendar by default. The dates after the reform are considered Gregorian accordingly. However, one can manually specify the calendar model of the entered date by annotating it with Jl or Gr (Old Style (OS) is also understood). Internally, Type:Date uses the proleptic Gregorian calendar, an extension of the Greogorian calendar to the past, to represent dates.
Maximal date range
Type:Date is able to handle dates across history with full precision for storing, and substantial precision for sorting and querying. The range of supported past dates should encompass the Beginning of Time according to most of today's theories. The range of supported future dates is limited more strictly, but it does also allow year numbers in the order of 10^9.
BC, negative years, and the year 0
Years before common era (aka BC) can be denoted using "BC" in a date. It is assumed that there is no "year 0": the historic sequence of years was ..., 2 BC, 1 BC, 1 AD, 2AD, ... When given as an input, the year 0 (BC or not) is interpreted as 1 BC, but this use is discouraged.
The internal numeric date model used in SMW supports the year 0, and considers it to be the same as "1 BC". According to this convention, e.g., the year "-100" is the same as "101 BC". This convention agrees with ISO 6801 and the remarks in XML Schema Datatypes 2nd Edition (the latter uses a different convention that disallows year 0, but it explicitly endorses the ISO convention and announces the future use of this in XML). Note that the implementation currently does not support the specification of negative year numbers as input; negative numbers are only used internally.
Time offsets and timezones
Time offests are supported (e.g. "1 1 2008 12:00-2:00"). As explained above, those refer to the local time. Time offsets take leap years into account, e.g. the date "Feb 28 2004 23:00+2:00" is equivalent to "29 February 2004 01:00:00", while "Feb 28 1900 23:00+2:00" is equivalent to "1 March 1900 01:00:00". Additionally, offsets can be specified by the common shortcuts for time zones (e.g. ADT, AST, CET, CST, CXT, EST, HAC, HAT, HNR, MEZ, MST, NFT): "1 March 1998 08:00:00 EST".
- The customised date formatting of MediaWiki can only be used for dates between typically between 1901-12-14 and 2038-01-19.
- Internationalisation is incomplete: "BC", "AD", "PM", "AM" are fixed for all languages.
- Conversion between (historic) calendar models is not supported yet.
Help:Datatype "Date" en 1.7.0 1.7.0