Template:DateStyle
28 September (N.S. 11 October) 2026
| This template uses Lua: |
| This template uses Lua: |
{{DateStyle}} is a template that converts between the following four calendar styles:
- The Gregorian calendar or New Style, with the year beginning on 1 January. This is the most commonly used calendar style today
- The Julian calendar with the year beginning on 1 January. This was historically used in most European countries before their adoption of the Gregorian calendar.
- The Julian calendar with the year beginning on 25 March, or Lady Day. This style is called the Annunciation Style, and was most notably used in the British Empire until the Calendar (New Style) Act 1750.
- The Julian calendar with the year beginning on 25 December, or Christmas. This style is called the Nativity Style, and was used in Germany and England until the 11th century, and in Spain in the 14th–16th centuries.
The following four templates serve as wrappers for it:
{{Gregorian to Julian}}{{Julian to Gregorian}}{{New Style to Annunciation Style}}{{Annunciation Style to New Style}}
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
{{DateStyle}} accepts the following parameters:
cal,calendar— The calendar style that the given date is in. Defaults toj.
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 tog, unless the inputted calendar style is Gregorian, in which case it defaults toj. Using one of the four wrapper templates above essentially replaces the parameterscalandout.format— EitherDMYorMDY. Defaults toDMY.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, butADorCEcould 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}}→ 28 September (N.S. 11 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}}→ September 29 (O.S. September 29), 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]]}}→ 28 September (N.S. 11 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}}→ 28 September [N.S. 11 October] 2025{{DateStyle|now|showyear=false}}→ 28 September (N.S. 11 October){{DateStyle|27 December 1022|stylelink=false|cal=n|out=a}}→ 27 December 1022 (O.S. 27 December 1021)
Limitations
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.