From Barbershop Wiki Project
Jump to: navigation, search

19 February 2019


This template converts a date to one of the standard date formats used on the English Wikipedia. This template is probably best used internally in other templates.

Do not subst this template in an attempt to obtain a permanent link to today's date, it will not work. Instead, use Template:Tlx


This template takes up to two parameters, both of which are optional:

{{date|<date to be formatted>|<date formatting style>}}

  • <date to be formatted> is an (optional) date to be formatted.
  • If a date is provided, but is not recognized as one, the text is just returned as is. Most dates will however be recognized as such, including all the formats typically used on Wikipedia. Numerous variations thereof are also supported, including abbreviated or lower case month names; genitive 'st', 'nd', 'rd', 'th'; extraneous white space; missing comma etc.
  • Notes:
    • Some dates are converted even if they are not real dates, and some dates are not converted even though they are real dates. See known issues below.
    • Only dates within the range Template:Date and Template:Date are supported. Dates with two digit dates will have unexpected results. Other dates outside the range 1000–9999 will be treated as if the second parameter were "none".
  • <date formatting style> controls the date format in which the result is to be emitted.
  • If no style is specified, the template emits a date in 'd month yyyy' format, as it appears (for example) on discussion pages.
  • Recognized values for the second parameter are:
    • none applies no formatting whatsoever
    • dmy gives d mmmm yyyy (eg Template:Date). This is the default format.
  • Prefixing these parameters with "l" (l for link) produces a linked date. Note: the Manual of Style explicitly discourages linking dates unless the linked article is relevant (see MOS:UNLINKDATES), thus this feature should seldom be used:
  • Notes:
    • Although these are the four formats supported by MediaWiki's date autoformatting mechanism, only dmy/ldmy and mdy/lmdy are in accordance with the English language Wikipedia's Manual of Style. The use of iso/liso (ISO 8601) format within article prose is expressly discouraged by the Manual of Style; this format should only be used in tables or lists.
    • In each case, the result is exactly the same as what would be emitted by MediaWiki's date autoformatting mechanism.
      However, dates are not manipulated by MediaWiki's date autoformatting mechanism even when linked. This permits dates to have a consistent appearance regardless of whether they are linked or not.