|
|
| Line 1: |
Line 1: |
| <!--
| | {{#invoke:Date|Date |
| INPUT PARAMETERS:
| | |year = {{{year|{{{1|}}}}}} |
| {{{1|}}} = year: {{#expr: {{{1|}}} }} will strip leading zeros if any
| | |month = {{{month|{{{2|}}}}}} |
| {{{2|}}} = month: input to {{I18n month}}
| | |day = {{{day|{{{3|}}}}}} |
| {{{3|}}} = day: {{#expr: {{{3}}} }} will strip leading zeros if any
| | |hour = {{{hour|}}} |
| {{{4|}}} = language code
| | |minute = {{{minute|}}} |
| {{{form|}}} = case
| | |second = {{{second|}}} |
| | | |class = {{{class|}}} |
| * <span style="white-space:nowrap"> - prevents date from being broken into two lanes
| | |lang = {{#if:{{{lang|{{{4|}}}}}} | {{{lang|{{{4|}}}}}} |{{int:Lang}}}} |
| | | |case = {{{case|{{{form|}}}}}} |
| -->{{#if: {{{1|}}} | {{#if:{{{class|dtstart}}} |<span style="white-space:nowrap"><time class="{{{class|dtstart}}}" datetime="{{padleft:{{{1}}}|4|0}}{{#if: {{{2|}}}|-{{padleft:{{{2}}}|2|0}}}}{{#if: {{{3|}}}|-{{padleft:{{{3}}}|2|0}}}}"> }} }}<!--
| | }}<noinclude> |
| -->{{#if: {{{1|}}}{{{2|}}}{{{3|}}} |
| |
| {{#switch: {{#if: {{{4|}}} | {{{4}}} | {{int:lang}} }}
| |
| | |
| <!-- Iberian language group (day de month de year) -->
| |
| |es |gl |pt |pt-br
| |
| ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} {{#if: {{{2|}}} | de }}}} {{#if: {{{2|}}} | {{I18n month|{{{2|}}}|{{{4|}}}}} {{#if: {{{1|}}} | de }}}} {{Trim|{{{1|}}}}}
| |
| | |
| <!-- Slavic group 1: if YYYY-MM-DD than month is in gen form, if YYYY-MM than month in basic form -->
| |
| |uk |be |be-tarask |el
| |
| ={{#if: {{{3|}}} | {{#expr:{{{3}}} }} {{I18n month|{{{2|}}}|{{{4|}}}|form=gen}} | {{I18n month|{{{2|}}}|{{{4|}}}}} }} {{Trim|{{{1|}}}}}
| |
| | |
| <!-- Slavic group 2: if YYYY-MM-DD than month is in gen form, if YYYY-MM than month form is controlled by {{{form}}} -->
| |
| |pl |ru ={{#if: {{{3|}}} | {{#expr:{{{3}}} }} {{I18n month|{{{2|}}}|{{{4|}}}|form=gen}} | {{I18n month|{{{2|}}}|{{{4|}}}|form={{{form|}}} }} }} {{Trim|{{{1|}}}}}
| |
| | |
| <!-- Slavic group 3: uses . after day. If YYYY-MM-DD than month is in gen form, if YYYY-MM than month in basic form. In both cases for can be overwritten by {{{form}}} -->
| |
| |cs|sl ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}. {{I18n month|{{{2|}}}|{{{4|}}}|form={{#if:{{{form|}}}|{{{form}}}|gen}}}} | {{I18n month|{{{2|}}}|{{{4|}}}|form={{{form|}}} }} }} {{Trim|{{{1|}}}}}
| |
| | |
| <!-- Finnish language: YYYY-MM-DD month in Partitive form, if YYYY-MM than month form is controlled by {{{form}}} -->
| |
| |fi ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}. {{I18n month|{{{2}}}|fi|form=ptv}} | {{I18n month|{{{2|}}}|fi|form={{{form|}}} }} }} {{Trim|{{{1|}}}}}
| |
| | |
| <!-- Germanic language group (day. month year) -->
| |
| |da |de |de-formal |de-at |de-ch |bar |et |nds |nn |no
| |
| ={{#if: {{{3|}}} | {{#expr:{{{3}}}}}.}} {{I18n month|{{{2|}}}|{{{4|}}}}} {{Trim|{{{1|}}}}}
| |
| | |
| <!-- South Asia group -->
| |
| |fa |hi |pa
| |
| ={{#if: {{{3|}}} | {{formatnum|{{#expr: {{{3}}} }}|{{{4|}}}|sep=1}} }} {{I18n month|{{{2|}}}|{{{4|}}}}} {{formatnum|{{{1|}}}|{{{4|}}}|sep=1}}
| |
| | |
| <!-- Chinese-like group (year年 month day日) -->
| |
| |zh |zh-hans |zh-hant |zh-cn |zh-tw |ja
| |
| ={{#if: {{{1|}}} | {{#expr:{{{1|}}}}}年}}{{I18n month|{{{2|}}}|{{{4|}}}}}{{#if: {{{3|}}} |{{#expr:{{{3|}}}}}日}}
| |
| | |
| <!-- day/month/year languages -->
| |
| |eo ={{#if: {{{3|}}} | la {{#expr: {{{3}}} }}-a de}} {{I18n month|{{{2|}}}|eo}} {{Trim|{{{1|}}}}} | |
| |fr ={{#if: {{{3|}}} | {{#expr: {{{3}}}}}{{#ifeq: {{{3|}}} | 1 |<sup>er</sup>}} }} {{I18n month|{{{2|}}}|fr}} {{Trim|{{{1|}}}}} | |
| |ga ={{#if: {{{3|}}} | {{#expr: {{{3}}}}}{{#ifeq: {{{3|}}} | 1 |<sup>ú</sup>}} }} {{I18n month|{{{2|}}}|ga}} {{Trim|{{{1|}}}}} | |
| |hr ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}.}} {{I18n month|{{{2|}}}|hr}} {{#if: {{{1|}}} | {{#expr: {{{1|}}} }}.}} | |
| |ia ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} de}} {{#if: {{{2|}}} | {{I18n month|{{{2|}}}|ia}} }} {{Trim|{{{1|}}}}} | |
| |mk ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} }} {{I18n month|{{{2|}}}|mk}} {{#expr: {{{1|}}} }} | |
| |oc ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} }} {{#if: {{{2|}}} | {{I18n month|{{{2|}}}|oc}} de }} {{Trim|{{{1|}}}}}
| |
| |sr ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}.}} {{I18n month|{{{2|}}}|sr}} {{#expr: {{{1|}}} }}.
| |
| |th ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} }} {{I18n month|{{{2|}}}|th}} {{#if: {{{1|}}} | {{#ifexpr: {{{1}}} <= 1940 | {{#if: {{{2|}}} | {{#ifexpr: {{{2|}}} < 4 | พ.ศ. {{#expr: {{{1}}} + 542 }} | พ.ศ. {{#expr: {{{1}}} + 543 }} }} | {{#expr: {{{1}}} + 542 }} หรือ {{#expr: {{{1}}} + 543 }} }} | พ.ศ. {{#expr: {{{1}}} + 543 }} }} }}
| |
| |vi ={{#expr:{{{3|}}}}} {{I18n month|{{{2|}}}|{{{4|}}}}} {{#if: {{{1|}} | năm {{{1}}} }}
| |
| | |
| <!-- year/month/day languages -->
| |
| |hu ={{#if: {{{1|}}} | {{#expr: {{{1}}} }}.}} {{I18n month|{{{2|}}}|hu}} {{#if: {{{3|}}} | {{#expr: {{{3}}} }}{{#if: {{{form|}}} | | . }} }}
| |
| |ko ={{#if: {{{1|}}} | {{#expr: {{{1|}}} }}년}} {{I18n month|{{{2|}}}|ko}} {{#if: {{{3|}}} |{{#expr:{{{3|}}}}}일}}
| |
| |lt ={{#if: {{{1|}}} | {{{1|}}} m. }} {{I18n month|{{{2|}}}|lt}} {{#if: {{{3|}}} | {{#expr: {{{3}}} }} d.}}
| |
| |lv ={{#if: {{{1|}}} | {{#expr:{{{1|}}}}}. gada }} {{#if: {{{3|}}} | {{#expr: {{{3}}} }}.}} {{I18n month|{{{2|}}}|lv}}
| |
| |ml ={{#if: {{{1|}}} | {{#expr: {{{3|}}} }} {{I18n month|{{{2|}}}|ml}} {{#expr:{{{1|}}} }}|{{I18n month|{{{2|}}}|ml}} {{#expr:{{{3|}}} }} }}
| |
| | |
| <!-- month/day/year languages -->
| |
| |kn|bn ={{I18n month|{{{2|}}}|{{{4|}}}}} {{#if: {{{3|}}} |{{formatnum|{{#expr: {{{3}}} }}|{{{4|}}}|sep=1}}}}{{#if: {{{2|}}}{{{3|}}} |,}} {{formatnum|{{{1|}}}|{{{4|}}}|sep=1}}
| |
| |mr ={{I18n month|{{{2|}}}|{{{4|}}}}} {{#if: {{{3|}}} |{{formatnum|{{#expr: {{{3}}} }}|{{{4|}}}|sep=1}}}}{{#if: {{{2|}}}{{{3|}}} |,}} इ.स. {{formatnum|{{{1|}}}|mr|sep=1}}
| |
| |new ={{I18n month|{{{2|}}}|{{{4|}}}}} {{#if: {{{3|}}} |{{formatnum|{{#expr: {{{3}}} }}|{{{4|}}}|sep=1}}}}{{#if: {{{2|}}}{{{3|}}} |,}} ई सं {{formatnum|{{{1|}}}|new|sep=1}}
| |
| |bpy ={{I18n month|{{{2|}}}|{{{4|}}}}} {{#if: {{{3|}}} |{{formatnum|{{#expr: {{{3}}} }}|{{{4|}}}|sep=1}}}}{{#if: {{{2|}}}{{{3|}}} |,}} মারি {{formatnum|{{{1|}}}|bpy|sep=1}}
| |
| | |
| <!-- default (English) group (day month year) -->
| |
| |#default={{#expr:{{{3|}}}}} {{I18n month|{{{2|}}}|{{{4|}}}}} {{Trim|{{{1|}}}}}
| |
| | |
| }}{{#if: {{{1|}}} | {{#if: {{{class|dtstart}}} |
| |
| </time></span>
| |
| }}}}}}<noinclude>
| |
| {{documentation}} | | {{documentation}} |
| </noinclude> | | </noinclude> |
Script error: No such module "Date".
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}} → Script error: No such module "Date".
{{date|2009|1}} → Script error: No such module "Date".
{{date|2009}} → Script error: No such module "Date".
Generating output in Polish:
{{date|2009|1|9|pl}} → Script error: No such module "Date".
{{date|2009|1|9|pl|case=}} → Script error: No such module "Date". - alternative way to get nominative case
{{date|2009|1|9|pl|case=gen}} → Script error: No such module "Date".
{{date|2009|1|9|pl|case=ins}} → Script error: No such module "Date".
{{date|2009|1|pl}} → Script error: No such module "Date".
{{date|2009|1|pl|form=gen}} → Script error: No such module "Date".
{{date|2009|1|pl|form=ins}} → Script error: No such module "Date".
{{date|year=888|lang=pl|case=ins|trim_year=yes}} → Script error: No such module "Date".
{{date|year=888|lang=pl|case=ins|trim_year=no}} → Script error: No such module "Date".
{{date|year=888|lang=pl|case=ins|trim_year=100-999}} → Script error: No such module "Date".
{{date|year=888|lang=pl|case=ins|trim_year=100-500}} → Script error: No such module "Date".
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:
Also Partitive (ptv), Inessive (ine), Elative (ela) and Illative (ill) cases are supported for Finnish language, in addition to Nominative and Genitive (gen). | 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:
- 1, yes, true - for always trimming
- 0, no, false - for always padding
- xx-yy - where xx is a minimum trimmed year and yy is the maximum trimmed year, for conditional trimming which depends on the year range.
| 100-999 | optional |
- TemplateData
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
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1 or useTemplateData=only on the /doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.
Wikipedia's help about TemplateData • Commons-specific information
Template parameters[Edit template data] This template prefers inline formatting of parameters. | Parameter | Description | Type | Status |
|---|
| year | 1 year | year
| Number | optional |
|---|
| month | 2 month | Month number or name (in English)
| Number | optional |
|---|
| day | 3 day | Day number
| Number | optional |
|---|
| language | 4 lang | Language code (overrides user's preferences) - Default
- language code of the user language
| Line | optional |
|---|
| case | case | Allows to specify grammatical case for the month for languages that use them.
| Unknown | optional |
|---|
| class | class | Allows to set 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). "class=-" will remove all metadata. - Default
- dtstart
| Unknown | optional |
|---|
| hour | hour | Hour number in 0-23 range
| Number | optional |
|---|
| minute | minute | Minutes number in 0-59 range
| Number | optional |
|---|
| second | second | Seconds number in 0-59 range
| Number | 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: 1, yes, true: for always trimming; 0, no, false: for always padding; xx-yy - where xx is a minimum trimmed year and yy is the maximum trimmed year, for conditional trimming which depends on the year range. - Default
- 100-999
| Unknown | optional |
|---|
|
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
== Localization ==