Type:Date

From Edge of Darkness Wiki

Date
Jump to: navigation, search

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.

Contents

Input examples

Examples of typical input dates in English language are:

The annotation in the following examples is incorrect:

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.

Display format

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 $wgLanguageCode.

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.

Calendar models

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. February 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".

Sorting dates in tabular outputs

The sortable table code of MediaWiki cannot handle dates. To make them sort properly, one needs to provide numeric sortkeys using the "data-sort-value" attribute in td elements (look at the HTML of any real SMW table for examples). To allow this to be done, the new parameter "#SORTKEY" was added to this datatype by which one can obtain a numeric sortkey as needed for "data-sort-value". For example, the following query displays dates and their sortkeys:

{{#ask: [[Modification date::+]]
| ?Modification date
| ?Modification date#SORTKEY
}}

For properties that can have many values, only one sortkey must be used (since the whole table row is sorted as one, even if many dates are in one cell). This can be achieved by using parameter "+limit" like in this example:

{{#ask: [[testdate::+]]
| ?testdate
| ?testdate#SORTKEY |+limit=1
}}

Open Issues



This type is among the standard datatypes of this wiki.

Facts about DateRDF feed
Has date11 February 2000 10:00:01  +, 11 February 2000  +, 2000  +, 11 February 2000 22:00:01  +, 11 February 2000 20:00:01  +, 2 February 2000  +, 3 February 2000  +, 1 January 300 BC  +, 2147483647 BC  +, 24 February 2000  +, 2 February 1492  +, 11 February 2000 10:00:00  +, 22 February 2000  +, warning.pngThe date "1999-00-00" was not understood. , and warning.pngThe date "Sun Jun 20 23:21:05 1993" was not understood.
Personal tools
Namespaces
Variants
Actions
Navigation
games
Toolbox