Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a459538b1e9feddd

Jump to content

Template:DateStyle/doc

From Wikipedia, the free encyclopedia

{{DateStyle}} is a template that converts between the following four calendar styles:

The following four templates serve as wrappers for it:

Dates can be inputted in any format that is understandable to MediaWiki's #time function. If the year in the Old and New Style calendars is the same, the brackets will be before the year and will only include the month and day. But if the years are different, the year will also be in the brackets.

Usage

[edit]

{{DateStyle}} accepts the following parameters:

  • cal, calendar — The calendar style that the given date is in. Defaults to j.
  • j, julian — The Julian calendar, with New Year's on 1 January.
  • a, as, annunciation, annunciation style — The Julian calendar, with New Year's on 25 March.
  • n, nativity, nativity style — The Julian calendar, with New Year's on 25 December.
  • g, gregorian — The Gregorian calendar.
  • out, output, to — The calendar style that the given date is to be converted to. Defaults to g, unless the inputted calendar style is Gregorian, in which case it defaults to j. Using one of the four wrapper templates above essentially replaces the parameters cal and out.
  • format — Either DMY or MDY. Defaults to DMY.
  • sb — Whether to use [square brackets] instead of (rounded brackets).
  • wd — Whether the date should be hyperlinked.
  • wm — Whether the month should be hyperlinked.
  • wy — Whether the year should be hyperlinked.
  • stylelink, link — Whether the "N.S." or "O.S." should be hyperlinked. Defaults to true.
  • ym — The year suffix. Defaults to nothing, but AD or CE could be passed.
  • showyear, year — Whether the year should be displayed at all. Defaults to true.

The date should be passed as an unlabelled parameter.

Examples
{{DateStyle}} → 5 October (N.S. 18 October) 2026
{{DateStyle|1 February 1602}} → 1 February (N.S. 11 February) 1602
{{DateStyle|February 1, 1602|cal=g}} → 1 February (O.S. 22 January) 1602
{{DateStyle|1602-2-1|calendar=as}} → 1 February 1602 (N.S. 11 February 1603)
{{DateStyle|1/2/1602|out=annunciation|format=MDY}} → January 2, 1602 (O.S. January 2, 1601)
{{DateStyle|February 1, 1602|calendar=julian|wd=true}} → 1 February (N.S. 11 February) 1602
{{DateStyle|+1 day|out=a|wd=true|wm=true|format=MDY}} → October 6 (O.S. October 6), 2026
{{DateStyle|20 January +1 year|cal=j|out=a|wd=true|wy=true}} → 20 January 2027 (O.S. 20 January 2026)
{{DateStyle|ym=[[Anno Domini|AD]]}} → 5 October (N.S. 18 October) 2026 AD
{{DateStyle|19 October 9999|wd=true|wm=true}} → 19 October (N.S. 31 December) 9999
{{DateStyle|-1 year|stylelink=false|sb=true}} → 5 October [N.S. 18 October] 2025
{{DateStyle|now|showyear=false}} → 5 October (N.S. 18 October)
{{DateStyle|27 December 1022|stylelink=false|cal=n|out=a}} → 27 December 1022 (O.S. 27 December 1021)

Limitations

[edit]

These templates parse the date using MediaWiki's #time function, which only supports years from 0. Therefore, the earliest date accepted by these templates is 1 January 1 BC in the proleptic Gregorian calendar, which is 1 January 0 CE using Astronomical year numbering.