แม่แบบ:Dts

จากวิกิพีเดีย สารานุกรมเสรี
Jump to navigation Jump to search
Documentation icon คู่มือการใช้งานแม่แบบ[ดู] [แก้] [ประวัติ] [ล้างแคช]
เอกสารกำกับแม่แบบนี้เอามาจากแม่แบบ:Dts/doc [แก้ไข]

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 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

Parameters[แก้]

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 ISO 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. ISO format defaults to US format.
    • Abbreviated months are accepted.
    • Capitilisation 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}}

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

Examples[แก้]

Normal function of the template. The template with debug=yes, which causes hidden parts to appear:

แม่แบบ:Dts/examples

แม่แบบ:Dts/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.

See also[แก้]

  • {{TBA}} - allows quarters, and allows sorting of time periods by end date.
  • m:แม่แบบ: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.
https://th.wikipedia.org/wiki/%E0%B9%81%E0%B8%A1%E0%B9%88%E0%B9%81%E0%B8%9A%E0%B8%9A:Dts
th.wikipedia.org
crawl=CC-MAIN-2018-26
66611
application/http; msgtype=response
sha1:5X4MOTIW2PLJOVSBJPR7HMDNWFPPQWQG
<urn:uuid:89ae2be1-7296-49c0-b11a-8cffe5fdebfb>
2018-06-23T19:40:41Z
208.80.154.224
text/html
sha1:4HSOXFGQDYS6LNEWRMX6SLBHNLYADOFT
<urn:uuid:d0554b9c-b9d4-4e0e-b0d6-a147ed4bb99a>
https://th.wikipedia.org/wiki/%E0%B9%81%E0%B8%A1%E0%B9%88%E0%B9%81%E0%B8%9A%E0%B8%9A:Dts
response
<urn:uuid:e390c6a0-e53f-4b28-a41d-6a7a492b59f3>
robots: classic
hostname: ip-10-91-167-62.ec2.internal
software: Nutch 1.6 (CC)
isPartOf: CC-MAIN-2018-26
operator: Common Crawl Admin
description: Wide crawl of the web for June 2018
publisher: Common Crawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf