Normally, for proper sorting, dates must be entered in YYYY-MM-DD format. However, that format does not conform to the Manual of Style for date display. This template automatically creates the hidden <span style="display:none">1776-07-04</span> for sorting purposes and then displays the date like this: July 4, 1776. To hide the output, use the {{dtsh}} template instead.
Parameters
Script error: No such module "Message box".
The year, month and day can either be entered separately or as a single date.
{{dts|year|month|day|BC}}
{{dts|date}}
1st parameter – Year (optional if month is given)
Year number – number in the range -9999 through 9999: the numbers -9999 through 0 are used without "bc" and represent astronomical years -9999 through 0, the numbers 1 through 9999 represent that year AD, or BC with the fourth parameter set to bc or BC
2nd parameter – Month (optional if the day is not given either)
Full month name – February or february
Abbreviated month name – Feb or feb
Month number – 2 or 02
3rd parameter – Day (optional)
Day number – 7 or 07
4th parameter – optional with value BC or bc
Used with a positive year number
Thus e.g. for the year 5 BC we can use "5|bc" or "-4".
A time period (year or month and year) is sorted according to its start, and time periods with the same starting moment are in order of descending length: a year comes before its first month; a month comes before its first day.
1st parameter – the full date in international, US or YYYY-MM-DD format
It uses {{#time:}} and so is limited to what the parser function can handle (e.g. it won't go beyond 100 AD).
International format is left as it is. YYYY-MM-DD format defaults to US format.
Abbreviated months are accepted.
Capitalisation and comma mistakes are corrected.
Input
{{dts|year|month|day|BC}}
{{dts|1776|July|4}}
{{dts|date}}
{{dts|1776-07-04}}
{{dts|July 4, 1776}}
{{dts|4 July 1776}}
If one of the latter formats is used there is a limit to the number of occurrences in a page, due to the use of the function #time.
<span style="display:none">01776-07-04</span> July 4, 1776 or
<span style="display:none">01776-07-04</span> 4 July 1776
Output displayed to user
July 4, 1776 or
4 July 1776
Linking
The template formerly linked dates automatically. To turn linking off the parameter link=off was used. In accordance with current guidelines linking is no longer supported. Please do not use this parameter. Please remove it from existing transclusions.
Examples
Normal function of the template.
The template with debug=yes, which causes hidden parts to appear:
Template syntax
Date rendered
{{dts|2001}}
02001 2001
{{dts||1|1}}
02021-01-01 January 1
{{dts|-50|July}}
-9949-07 July 50 BC
{{dts|-1000|July|4}}
-8999-07-04 July 4, 1000 BC
{{dts|5|July|4|BC}}
-9995-07-04 July 4, 5 BC
{{dts|40|July|4|BC}}
-9960-07-04 July 4, 40 BC
{{dts|1|July|4|BC}}
-9999-07-04 July 4, 1 BC
{{dts|88|July|4}}
00088-07-04 July 4, 88
{{dts|2007|7|11}}
02007-07-11 July 11, 2007
{{dts|2001|sep|11}}
02001-09-11 September 11, 2001
{{dts|format=dmy|2001}}
02001 2001
{{dts|format=dmy||1|1}}
02021-01-01 1 January
{{dts|format=dmy|-50|July}}
-9949-07 July 50 BC
{{dts|format=dmy|-1000|July|4}}
-8999-07-04 4 July 1000 BC
{{dts|format=dmy|5|July|4|BC}}
-9995-07-04 4 July 5 BC
{{dts|format=dmy|40|July|4|BC}}
-9960-07-04 4 July 40 BC
{{dts|format=dmy|1|July|4|BC}}
-9999-07-04 4 July 1 BC
{{dts|format=dmy|88|July|4}}
00088-07-04 4 July 88
{{dts|format=dmy|2007|7|11}}
02007-07-11 11 July 2007
{{dts|format=dmy|2001|sep|11}}
02001-09-11 11 September 2001
{{dts|2001}}
02001 2001
{{dts|1 January}}
02021-01-011 January
{{dts|July 19}}
02021-07-19July 19
{{dts|10 July 1994}}
01994-07-1010 July 1994
{{dts|July 4, 1555}}
01555-07-04July 4, 1555
{{dts|24 Sep 2004}}
02004-09-2424 Sep 2004
{{dts|format=mdy|1 July 1893}}
01893-07-01July 1, 1893
{{dts|format=dmy|July 4, 1688}}
01688-07-044 July 1688
{{dts|format=dmy|2007-7-11}}
02007-07-1111 July 2007
{{dts|2001-11-11}}
02001-11-11November 11, 2001
Template syntax
Date rendered
{{dts|debug=yes|2001}}
02001 2001
{{dts|debug=yes||1|1}}
02021-01-01 January 1
{{dts|debug=yes|-50|July}}
-9949-07 July 50 BC
{{dts|debug=yes|-1000|July|4}}
-8999-07-04 July 4, 1000 BC
{{dts|debug=yes|5|July|4|BC}}
-9995-07-04 July 4, 5 BC
{{dts|debug=yes|40|July|4|BC}}
-9960-07-04 July 4, 40 BC
{{dts|debug=yes|1|July|4|BC}}
-9999-07-04 July 4, 1 BC
{{dts|debug=yes|88|July|4}}
00088-07-04 July 4, 88
{{dts|debug=yes|2007|7|11}}
02007-07-11 July 11, 2007
{{dts|debug=yes|2001|sep|11}}
02001-09-11 September 11, 2001
{{dts|format=dmy|debug=yes|2001}}
02001 2001
{{dts|format=dmy|debug=yes||1|1}}
02021-01-01 1 January
{{dts|format=dmy|debug=yes|-50|July}}
-9949-07 July 50 BC
{{dts|format=dmy|debug=yes|-1000|July|4}}
-8999-07-04 4 July 1000 BC
{{dts|format=dmy|debug=yes|5|July|4|BC}}
-9995-07-04 4 July 5 BC
{{dts|format=dmy|debug=yes|40|July|4|BC}}
-9960-07-04 4 July 40 BC
{{dts|format=dmy|debug=yes|1|July|4|BC}}
-9999-07-04 4 July 1 BC
{{dts|format=dmy|debug=yes|88|July|4}}
00088-07-04 4 July 88
{{dts|format=dmy|debug=yes|2007|7|11}}
02007-07-11 11 July 2007
{{dts|format=dmy|debug=yes|2001|sep|11}}
02001-09-11 11 September 2001
{{dts|debug=yes|2001}}
02001 2001
{{dts|debug=yes|1 January}}
02021-01-011 January
{{dts|debug=yes|July 19}}
02021-07-19July 19
{{dts|debug=yes|10 July 1994}}
01994-07-1010 July 1994
{{dts|debug=yes|July 4, 1555}}
01555-07-04July 4, 1555
{{dts|debug=yes|24 Sep 2004}}
02004-09-2424 Sep 2004
{{dts|format=mdy|debug=yes|1 July 1893}}
01893-07-01July 1, 1893
{{dts|format=dmy|debug=yes|July 4, 1688}}
01688-07-044 July 1688
{{dts|format=dmy|debug=yes|2007-7-11}}
02007-07-1111 July 2007
{{dts|debug=yes|2001-11-11}}
02001-11-11November 11, 2001
Error handling
During early 2009, Template:Dts generated month names for invalid month numbers, such as number 23 displaying "November". No warning is displayed, for the formatted page, that such invalid dates are being used on the page.