Template:Date/doc

From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search

Description[edit source]

Converts almost any reasonable date representation into a properly formatted date according a specific date format (MDY, DMY, ISO, etc.).

Template parameters

ParameterDescriptionTypeStatus
Input date1

The date to format. It understands all formats detailed on the documentation.

Example
{{Date|2020-09-20}}
Stringrequired
Output format2

The format in which the date will be displayed.

Suggested values
dmy, mdy, ymd, iso
Default
dmy
Example
{{Date|2020-09-20|mdy}}
Stringoptional
Force year linking3

If you want to link the year to its article. (nobody uses this)

Suggested values
y
Example
{{Date|2020-09-20|3=y}}
Stringoptional

Supported input formats[edit source]

Input example What the template understands it as Notes / typical use case
2020-09-20 Full ISO date (yyyy-mm-dd) Most common modern format
20200920 Compact ISO / ymd numeric Widely used in templates and databases
2020/09/20 ISO with slashes Accepted variant
2020-9-20 Single-digit month/day (no leading zero) Works perfectly
20200920143045 14-digit timestamp (yyyymmddhhmmss) Auto-detected as full timestamp
20 September 2020 Full natural DMY Classic Wikipedia style
September 20, 2020 Full natural MDY American style
20 Sep 2020 Abbreviated month DMY Also accepted
Sep 20, 2020 Abbreviated month MDY Also accepted
20 September Day + month (no year) → 20 September 2020 Assumes current or context year
September 2020 Month + year only → September 2020
2020-09 Year-month (yyyy-mm) → September 2020
202009 Year-month compact → September 2020
September 20 Month + day (no year) → 20 September (in current year)
2020 Year only → 2020
2020-09-20T14:30:45Z ISO 8601 with time (ignored) Date part still parsed correctly
{{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}} Wiki variables Works when the template is rendered

Invalid / rejected inputs (output nothing or “none”)[edit source]

  • nonsense
  • 32 September 2020
  • February 30
  • 2020-13-05
  • 0000-00-00
  • (very old dates before ~1000 CE are sometimes suppressed on purpose)

Supported output formats[edit source]

Value Name Example output Notes
(leave blank) Default 20 September 2020 Defaults to dmy
dmy Day Month Year 20 September 2020 Standard unlinked British/Australian style
mdy Month Day, Year September 20, 2020 Standard unlinked American style
ymd Year Month Day 2020 September 20 Rare, used in some East-Asian contexts
iso ISO 8601 2020-09-20 Machine-readable
asis As-is (whatever you typed) No formatting at all
none Suppress output (nothing) Returns nothing