Date table sorting stands for Date Table Sorting and is used to correctly sort and display dates in a sortable table (see Help:Sorting).
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 1776-07-04
for sorting purposes and then displays the date like this:
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. |
|
{{dts|year|month|day|BC}}
dts|1776|July|4
}}{{dts|date}}
dts|1776-07-04
}}dts|July 4, 1776
}}dts|4 July 1776
}}Also see the examples below.
Output sent to table
or July 4, 1776
4 July 1776Output displayed to user
Normal function of the template. | The template with debug=yes , which causes hidden parts to appear: |
---|---|
แม่แบบ:Dts/examples | แม่แบบ:Dts/examples |
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.
คู่มือการใช้งานที่ปรากฏด้านบนนี้ดึงมาจาก แม่แบบ:Date table sorting/doc (แก้ | ประวัติ) ผู้เขียนสามารถทำการทดลองได้ที่กระบะทราย (สร้าง | คัดลอก) และชุดทดสอบ (สร้าง) ของแม่แบบนี้ โปรดเพิ่มหมวดหมู่ไปที่หน้าย่อย /doc หน้าย่อยของแม่แบบนี้ |