Template:Date
This template has been protected from editing to prevent vandalism. Please discuss changes on the talk page or request unprotection. |
Uses Lua: |
This template is used to show a date in the language set in the preferences.
You can leave out parts of the data.
Usage
{{Date |1= |2= |3= |hour= |minute= |second= }}
Examples:
{{date|2009|1|9}}
→ 9 January 2009{{date|2009|1}}
→ January 2009{{date|2009}}
→ 2009
Generating output in Polish:
{{date|2009|1|9|pl}}
→ 9 stycznia 2009{{date|2009|1|9|pl|case=}}
→ 9 stycznia 2009 - alternative way to get nominative case{{date|2009|1|9|pl|case=gen}}
→ 9 stycznia 2009{{date|2009|1|9|pl|case=ins}}
→ 9 stycznia 2009{{date|2009|1|pl}}
→ styczeń 2009{{date|2009|1|pl|form=gen}}
→ styczeń 2009{{date|2009|1|pl|form=ins}}
→ styczeń 2009{{date|year=888|lang=pl|case=ins|trim_year=yes}}
→{{date|year=888|lang=pl|case=ins|trim_year=no}}
→{{date|year=888|lang=pl|case=ins|trim_year=100-999}}
→{{date|year=888|lang=pl|case=ins|trim_year=100-500}}
→
Microformat
The template returns the date, embed in a <time> element with attribute datetime that contain the date in the ISO 8601 format needed by the hCalendar (class="dtstart"
) microformat. See the microformats project.
Template parameters
Parameter | Description | Default | Status | |
---|---|---|---|---|
1 year | year | Year number | empty | optional |
2 month | month | Month number or name (in English) | empty | optional |
3 day | day | Day number | empty | optional |
hour | hour | Hour number in 0-23 range | empty | optional |
minute | minute | Minutes number in 0-59 range | empty | optional |
second | second | Seconds number in 0-59 range | empty | optional |
4 lang | language | Language code (overrides user's preferences) | language code of the user language | optional |
case | case | By default each language uses preferred form of the date, which typically has month in nominative or genitive grammatical case. With case parameter one can overwrite the preferred case with some other one used by a given language. Parser function {{#time}} stores nominative and genitive forms, others are stored in Data:I18n/MonthCases.tab. This functionality is mostly used by Module:Complex date. Possible cases:
| empty | optional |
class | class | Allows setting of the HTML class of the time node where the date is included. This is useful for microformats. The default value is, for legacy reasons, "dtstart" (used by hCalendar). See the microformats project. "class=-" will remove all metadata. | dtstart | optional |
trim_year trim year | trim year | Should years smaller than 1000 be padded with zeros to the length of 4 digits or trimmed. Options:
| 100-999 | optional |
Template data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard. Existing template documentation Newly created template documentation and imports Wikipedia's help about TemplateData • Commons-specific information This template is used to show a date in the language set in the preferences. You can leave out parts of the data.
|
Additional information
The template is intended to be used in the following namespaces: the Template namespace
The template is intended to be used by the following user groups: all users
Relies on:
Module:DateI18n
See also
{{ISOdate}} – Template used to parse the date in {{Information}}
{{Other date}} – Allows to specify a range of non-trivial date notations in a format that is localizable
{{Odate}} – Allows to specify two dates, of original and of vectorization
Localize the date format at Module:I18n/date or request assistance at Template talk:Date or Module talk:I18n/date