Template:Dts/doc

 stands for D ate T able S orting and is used to correctly sort and display dates in a sortable table (see Help:Sorting).

What it solves
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  for sorting purposes and then displays the date like this: July 4, 1776. To hide the output, use the dtsh template instead.

Input




When supplying a single parameter for the date, it is accepted and interpreted according to the php date/time format, except that a single number is interpreted as a year. By default the date is shown as supplied. If the first parameter is not just the year, but no format parameter is supplied, due to a call of function  the maximum number of calls of this template on a page is 1200.

Using format=mdy, format=dmy, or format=auto produces a format that depends on, but is not necessarily equal to the format of the supplied date. This requires multiple calls of function, reducing the maximum number of calls of this template on a page in the worst case to 88, see below.

Also see the examples below.

Output
Output sent to table
 * or

Output displayed to user
 * July 4, 1776 or
 * 4 July 1776

Linking
The template formerly linked dates automatically. To turn linking off the parameter  was used. In accordance with current guidelines linking is no longer supported. Please do not use this parameter. Please remove it from existing transclusions.

Limitation
Template:Dts/formauto calls  with format strings with a total length of up to 68 characters. The worst case is when the default case of the  applies, e.g. for the format 1876-08-25. In that case the template can only be called 88 times (here less because of the other examples):

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.