Dts/شرح stands for 'D'ate 'T'able 'S'orting and is used to correctly sort and display dates in a sortable table (see مساعدة:ترتيب القوائم).
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 <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.
المعلمات
Date display can be modified using two named parameters.
To use international date formats, use the format=dmy parameter.
To turn off the suppression of word wraps, use the nowrap=off parameter.
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|July 4, 1776}}
{{dts|July 4 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 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.
<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
4 يوليو 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.
أمثلة
Normal function of the template.
The template with debug=yes, which causes hidden parts to appear:
Template syntax
Date rendered
{{dts|2001}}
000000002001-01-01-00002001
{{dts||1|1}}
000000002024-01-01-0000يناير 1
{{dts|-50|July}}
-999999999950-07-01-0000يوليو 50 ق.م
{{dts|-1000|July|4}}
-999999999000-07-04-0000يوليو 4, 1000 ق.م
{{dts|5|July|4|BC}}
-999999999995-07-04-0000يوليو 4, 5 ق.م
{{dts|40|July|4|BC}}
-999999999960-07-04-0000يوليو 4, 40 ق.م
{{dts|1|July|4|BC}}
-999999999999-07-04-0000يوليو 4, 1 ق.م
{{dts|88|July|4}}
Error in Template:Dts: '4 يوليو 88' is an invalid date
{{dts|2007|7|11}}
000000002007-07-11-000011 يوليو 2007
{{dts|2001|sep|11}}
000000002001-09-11-0000Sep 11, 2001
{{dts|format=dmy|2001}}
000000002001-01-01-00002001
{{dts|format=dmy||1|1}}
000000002024-01-01-00001 يناير
{{dts|format=dmy|-50|July}}
-999999999950-07-01-0000يوليو 50 ق.م
{{dts|format=dmy|July}}
000000002024-07-01-0000يوليو
{{dts|format=dmy||July}}
000000002024-07-01-0000يوليو
{{dts|format=dmy|-1000|July|4}}
-999999999000-07-04-00004 يوليو 1000 ق.م
{{dts|format=dmy|5|July|4|BC}}
-999999999995-07-04-00004 يوليو 5 ق.م
{{dts|format=dmy|40|July|4|BC}}
-999999999960-07-04-00004 يوليو 40 ق.م
{{dts|format=dmy|1|July|4|BC}}
-999999999999-07-04-00004 يوليو 1 ق.م
{{dts|format=dmy|88|July|4}}
000000000088-07-04-00004 يوليو 88
{{dts|format=dmy|2007|7|11}}
000000002007-07-11-000011 يوليو 2007
{{dts|format=dmy|2001|sep|11}}
000000002001-09-11-000011 Sep 2001
{{dts|2001}}
000000002001-01-01-00002001
{{dts|1 January}}
000000002024-01-01-00001 يناير
{{dts|July 19}}
000000002024-07-19-000019 يوليو
{{dts|July 1923}}
000000001923-07-01-0000يوليو 1923
{{dts|10 July 1994}}
000000001994-07-10-000010 يوليو 1994
{{dts|July 4, 1555}}
000000001555-07-04-00004 يوليو 1555
{{dts|24 Sep 2004}}
000000002004-09-24-000024 سبتمبر 2004
{{dts|format=mdy|1 July 1893}}
000000001893-07-01-0000يوليو 1, 1893
{{dts|format=dmy|July 4, 1688}}
000000001688-07-04-00004 يوليو 1688
{{dts|format=dmy|2007-7-11}}
000000002007-07-11-000011 يوليو 2007
{{dts|2001-11-11}}
000000002001-11-11-000011 نوفمبر 2001
Template syntax
Date rendered
{{dts|debug=yes|2001}}
000000002001-01-01-00002001
{{dts|debug=yes||1|1}}
000000002024-01-01-0000يناير 1
{{dts|debug=yes|-50|July}}
-999999999950-07-01-0000يوليو 50 ق.م
{{dts|debug=yes|-1000|July|4}}
-999999999000-07-04-0000يوليو 4, 1000 ق.م
{{dts|debug=yes|5|July|4|BC}}
-999999999995-07-04-0000يوليو 4, 5 ق.م
{{dts|debug=yes|40|July|4|BC}}
-999999999960-07-04-0000يوليو 4, 40 ق.م
{{dts|debug=yes|1|July|4|BC}}
-999999999999-07-04-0000يوليو 4, 1 ق.م
{{dts|debug=yes|88|July|4}}
Error in Template:Dts: '4 يوليو 88' is an invalid date
{{dts|debug=yes|2007|7|11}}
000000002007-07-11-000011 يوليو 2007
{{dts|debug=yes|2001|sep|11}}
000000002001-09-11-0000Sep 11, 2001
{{dts|format=dmy|debug=yes|2001}}
000000002001-01-01-00002001
{{dts|format=dmy|debug=yes||1|1}}
000000002024-01-01-00001 يناير
{{dts|format=dmy|debug=yes|-50|July}}
-999999999950-07-01-0000يوليو 50 ق.م
{{dts|format=dmy|debug=yes|July}}
000000002024-07-01-0000يوليو
{{dts|format=dmy|debug=yes||July}}
000000002024-07-01-0000يوليو
{{dts|format=dmy|debug=yes|-1000|July|4}}
-999999999000-07-04-00004 يوليو 1000 ق.م
{{dts|format=dmy|debug=yes|5|July|4|BC}}
-999999999995-07-04-00004 يوليو 5 ق.م
{{dts|format=dmy|debug=yes|40|July|4|BC}}
-999999999960-07-04-00004 يوليو 40 ق.م
{{dts|format=dmy|debug=yes|1|July|4|BC}}
-999999999999-07-04-00004 يوليو 1 ق.م
{{dts|format=dmy|debug=yes|88|July|4}}
000000000088-07-04-00004 يوليو 88
{{dts|format=dmy|debug=yes|2007|7|11}}
000000002007-07-11-000011 يوليو 2007
{{dts|format=dmy|debug=yes|2001|sep|11}}
000000002001-09-11-000011 Sep 2001
{{dts|debug=yes|2001}}
000000002001-01-01-00002001
{{dts|debug=yes|1 January}}
000000002024-01-01-00001 يناير
{{dts|debug=yes|July 19}}
000000002024-07-19-000019 يوليو
{{dts|debug=yes|July 1923}}
000000001923-07-01-0000يوليو 1923
{{dts|debug=yes|10 July 1994}}
000000001994-07-10-000010 يوليو 1994
{{dts|debug=yes|July 4, 1555}}
000000001555-07-04-00004 يوليو 1555
{{dts|debug=yes|24 Sep 2004}}
000000002004-09-24-000024 سبتمبر 2004
{{dts|format=mdy|debug=yes|1 July 1893}}
000000001893-07-01-0000يوليو 1, 1893
{{dts|format=dmy|debug=yes|July 4, 1688}}
000000001688-07-04-00004 يوليو 1688
{{dts|format=dmy|debug=yes|2007-7-11}}
000000002007-07-11-000011 يوليو 2007
{{dts|debug=yes|2001-11-11}}
000000002001-11-11-000011 نوفمبر 2001
Abbreviating the month name
The template displays the name of the month either in abbreviated form or fully spelt out. There are two ways of controlling which is used.
Directly input the desired format.
Use the abbr parameter.
Note that the method to use is determined by the input. The first method works wherever the second method fails and only in these cases. The following explains which method to use.
All numeric input
If the month is input as a number, the default is to spell it out in full.
Entering a non-numeric month as the second unnamed parameter
The name of the month either in abbreviated form or fully spelt out when input as the second unnamed parameter. In either case the output form is equivalent to the input form.
The whole date as a single parameter with a non-numeric month
The if the whole date is entered as a single parameter with a non-numeric month, the default is to display the date as input. In this case either abbreviate or fully spelt out he name of the month as desired.
{{dts|1 January 2000}} gives "000000002000-01-01-00001 يناير 2000"
{{dts|1 Jan 2000}} gives "000000002000-01-01-00001 Jan 2000"
Using the format parameter overrides this default behaviour and the month name is spelt out in full by default. In this case the month can be abbreviated by setting abbr to on.
{{dts|1 January 2000|format=my}} gives "000000002000-01-01-0000يناير 2000"
{{dts|1 Jan 2000|format=my}} gives "000000002000-01-01-0000Jan 2000"
{{dts|1 January 2000|format=my|abbr=on}} gives "000000002000-01-01-0000Jan 2000"
{{dts|1 Jan 2000|format=my|abbr=on}} gives "000000002000-01-01-0000Jan 2000"
Error handling
Entering an invalid date format will (generally) produce an error message such as the one below.
Error in Template:Dts: days must be an integer between 1 and 31