Template:Date
Jump to navigation
Jump to search
Documentation The documentation below is transcluded from Template:Date/doc. (edit | history)
[purge]
This template is used to display a date in a standardized format.
Usage
{{ date | <year> | <month> | <day> }}
or
{{ date | date = <date string> }}
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Year | 1 | Year; preferably with exactly four digits.
| Line | suggested |
| Month | 2 | Month; 1 to 12, with or without leading zero.
| Line | suggested |
| Day | 3 | Day; 1 to 31, with or without leading zero.
| Line | suggested |
| Date | date | Alternative to the three unnamed parameters, will override them if specified. See mw:Time for accepted values.
| Line | optional |
| Day toggle | day | Whether to display the day part (as opposed to just year and month). Default is true if $date is used; otherwise depends on whether $3 is specified.
| Boolean | optional |
| Language | lang | Output language. Can almost always be omitted as it defaults to the result of {{lang}} (local wiki language).
| Line | optional |
This template prefers inline formatting of parameters.
Examples
| Code | Output |
|---|---|
{{date|2011|05|16}} |
May 16, 2011 |
{{date|2011|05}} |
May 2011 |
{{date|2011|05|16|day=no}} |
May 2011 |
{{date|2011|05|day=yes}} |
May 1, 2011 |
{{date|date=2011 May}} |
May 1, 2011 |
{{date|date=may 16, 2011}} |
May 16, 2011 |
{{date|date=2011 May|day=no}} |
May 2011 |
{{date|2011|05|16|lang=zh}} |
2011 年 05 月 16 日 |