ទំព័រគំរូ:Dts
Dts stands for Date Table Sorting 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 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
[កែប្រែ]Date display can be modified using two named parameters.
|
{{dts|year|month|day|BC}} | {{dts|date}} |
---|---|
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. |
|
Input
[កែប្រែ]{{dts|year|month|day|BC}}
- {{
dts|1776|July|4
}}
{{dts|date}}
- {{
dts|1776-07-04
}} - {{
dts|July 4, 1776
}} - {{
dts|4 July 1776
}}
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 #time
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 #time
, 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
<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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Limitation
[កែប្រែ]Template:Dts/formauto calls #time
with format strings with a total length of up to 68 characters.
The worst case is when the default case of the #switch
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: Too many #time calls.; Error: Too many #time calls.; Error: Too many #time calls.; Error: Too many #time calls.; Error: Too many #time calls.; Error: Too many #time calls.
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.
See also
[កែប្រែ]- {{dtsh}}, hides the template's output
- {{TBA}}, allows quarters, and allows sorting of time periods by end date.
- m:Template:dts (backlinks, edit), since on Meta e.g. 09999 9999 induces numeric sort mode, "&" is prefixed to force string sort mode.
- {{dts1}}
- {{dts vgr}}, for video game release dates.
- {{sort}}, sorting by a specified key
- {{sortname}}, full name sorting.
- {{tts}}, for sorting times in result tables of athletic events (only needed in certain cases - see template documentation)