跳至內容

英文维基 | 中文维基 | 日文维基 | 草榴社区

模板:Age in years and months/testcases

維基百科,自由的百科全書

測試 1

[編輯]
{{Age in years and months|year1=2001|month1=1|day1=10|year2=2012|month2=2|day2=20}}
  • {{Age in years and months|year1=2001|month1=1|day1=10|year2=2012|month2=2|day2=20}} → 11年1個月
  • {{Age in years and months/sandbox|year1=2001|month1=1|day1=10|year2=2012|month2=2|day2=20}} → 11年1個月
{{Age in years and months|year=2001|month=1|day=10|year2=2012|month2=2|day2=20}}
  • {{Age in years and months|year=2001|month=1|day=10|year2=2012|month2=2|day2=20}} → 11年1個月
  • {{Age in years and months/sandbox|year=2001|month=1|day=10|year2=2012|month2=2|day2=20}} → 11年1個月
{{Age in years and months|2001|1|10|2012|2|20}}
  • {{Age in years and months|2001|1|10|2012|2|20}} → 11年1個月
  • {{Age in years and months/sandbox|2001|1|10|2012|2|20}} → 11年1個月
{{Age in years and months|2001-1-10|2012-2-20}}
  • {{Age in years and months|2001-1-10|2012-2-20}} → 11年1個月
  • {{Age in years and months/sandbox|2001-1-10|2012-2-20}} → 11年1個月
{{Age in years and months|10 Jan 2001|20 Feb 2012}}
  • {{Age in years and months|10 Jan 2001|20 Feb 2012}} → 11年1個月
  • {{Age in years and months/sandbox|10 Jan 2001|20 Feb 2012}} → 11年1個月
{{Age in years and months|January 10, 2001|Feb 20, 2012}}
  • {{Age in years and months|January 10, 2001|Feb 20, 2012}} → 11年1個月
  • {{Age in years and months/sandbox|January 10, 2001|Feb 20, 2012}} → 11年1個月

測試 2

[編輯]

If the first or second date is omitted, the current date is used.

{{Age in years and months|year2=2012|month2=2|day2=20}}
  • {{Age in years and months|year2=2012|month2=2|day2=20}} → −12年10個月
  • {{Age in years and months/sandbox|year2=2012|month2=2|day2=20}} → −12年10個月
{{Age in years and months||||2012|2|20}}
  • {{Age in years and months||||2012|2|20}} → −12年10個月
  • {{Age in years and months/sandbox||||2012|2|20}} → −12年10個月
{{Age in years and months||2012-2-20}}
  • {{Age in years and months||2012-2-20}} → −12年10個月
  • {{Age in years and months/sandbox||2012-2-20}} → −12年10個月
{{Age in years and months||20 Feb 2012}}
  • {{Age in years and months||20 Feb 2012}} → −12年10個月
  • {{Age in years and months/sandbox||20 Feb 2012}} → −12年10個月
{{Age in years and months||Feb 20, 2012}}
  • {{Age in years and months||Feb 20, 2012}} → −12年10個月
  • {{Age in years and months/sandbox||Feb 20, 2012}} → −12年10個月
{{Age in years and months|year1=2001|month1=1|day1=10}}
  • {{Age in years and months|year1=2001|month1=1|day1=10}} → 23年11個月
  • {{Age in years and months/sandbox|year1=2001|month1=1|day1=10}} → 23年11個月
{{Age in years and months|year=2001|month=1|day=10}}
  • {{Age in years and months|year=2001|month=1|day=10}} → 23年11個月
  • {{Age in years and months/sandbox|year=2001|month=1|day=10}} → 23年11個月
{{Age in years and months|2001|1|10}}
  • {{Age in years and months|2001|1|10}} → 23年11個月
  • {{Age in years and months/sandbox|2001|1|10}} → 23年11個月
{{Age in years and months|2001-1-10}}
  • {{Age in years and months|2001-1-10}} → 23年11個月
  • {{Age in years and months/sandbox|2001-1-10}} → 23年11個月
{{Age in years and months|10 Jan 2001}}
  • {{Age in years and months|10 Jan 2001}} → 23年11個月
  • {{Age in years and months/sandbox|10 Jan 2001}} → 23年11個月
{{Age in years and months|January 10, 2001}}
  • {{Age in years and months|January 10, 2001}} → 23年11個月
  • {{Age in years and months/sandbox|January 10, 2001}} → 23年11個月

測試 3

[編輯]

時間和歲數用age參數區分:

{{Age in years and months|year2=2012|month2=2|day2=20|age=no}}
  • {{Age in years and months|year2=2012|month2=2|day2=20|age=no}} → −12年10個月
  • {{Age in years and months/sandbox|year2=2012|month2=2|day2=20|age=no}} → −12年10個月
{{Age in years and months||||2012|2|20|age=false}}
  • {{Age in years and months||||2012|2|20|age=false}} → −12年10個月
  • {{Age in years and months/sandbox||||2012|2|20|age=false}} → −12年10個月
{{Age in years and months||2012-2-20|age=off}}
  • {{Age in years and months||2012-2-20|age=off}} → −12年10個月
  • {{Age in years and months/sandbox||2012-2-20|age=off}} → −12年10個月
{{Age in years and months||20 Feb 2012|age=on}}
  • {{Age in years and months||20 Feb 2012|age=on}} → −12歲10個月
  • {{Age in years and months/sandbox||20 Feb 2012|age=on}} → −12歲10個月
{{Age in years and months||Feb 20, 2012|age=true}}
  • {{Age in years and months||Feb 20, 2012|age=true}} → −12歲10個月
  • {{Age in years and months/sandbox||Feb 20, 2012|age=true}} → −12歲10個月
{{Age in years and months|year1=2001|month1=1|day1=10|age=yes}}
  • {{Age in years and months|year1=2001|month1=1|day1=10|age=yes}} → 23歲11個月
  • {{Age in years and months/sandbox|year1=2001|month1=1|day1=10|age=yes}} → 23歲11個月
{{Age in years and months|year=2001|month=1|day=10}}
  • {{Age in years and months|year=2001|month=1|day=10}} → 23年11個月
  • {{Age in years and months/sandbox|year=2001|month=1|day=10}} → 23年11個月

測試 4

[編輯]

Examples using the range parameter follow.

{{Age in years and months|year=2001|month=1|year2=2012|month2=2|range=yes}}
  • {{Age in years and months|year=2001|month=1|year2=2012|month2=2|range=yes}} → 11年0或1個月
  • {{Age in years and months/sandbox|year=2001|month=1|year2=2012|month2=2|range=yes}} → 11年0或1個月
{{Age in years and months|2001|1||2012|2|range=yes}}
  • {{Age in years and months|2001|1||2012|2|range=yes}} → 11年0或1個月
  • {{Age in years and months/sandbox|2001|1||2012|2|range=yes}} → 11年0或1個月
{{Age in years and months|Jan 2001|Feb 2012|range=yes}}
  • {{Age in years and months|Jan 2001|Feb 2012|range=yes}} → 11年0或1個月
  • {{Age in years and months/sandbox|Jan 2001|Feb 2012|range=yes}} → 11年0或1個月
{{Age in years and months|Jan 2001|Feb 2012|range=dash}}
  • {{Age in years and months|Jan 2001|Feb 2012|range=dash}} → 11年0—1個月
  • {{Age in years and months/sandbox|Jan 2001|Feb 2012|range=dash}} → 11年0—1個月
{{Age in years and months|Jan 2001|Feb 2012|range=no}}
  • {{Age in years and months|Jan 2001|Feb 2012|range=no}} → 11年1個月
  • {{Age in years and months/sandbox|Jan 2001|Feb 2012|range=no}} → 11年1個月
  • (assume 1 Jan 2001 to 1 Feb 2012)
{{Age in years and months|12 Jan 2001|Feb 2012|range=no}}
  • {{Age in years and months|12 Jan 2001|Feb 2012|range=no}} → 11年1個月
  • {{Age in years and months/sandbox|12 Jan 2001|Feb 2012|range=no}} → 11年1個月
  • (assume 12 Jan 2001 to 12 Feb 2012)
{{Age in years and months|2001|2012|range=no}}
  • {{Age in years and months|2001|2012|range=no}} → 11年
  • {{Age in years and months/sandbox|2001|2012|range=no}} → 11年
  • (assume 1 Jan 2001 to 1 Jan 2012)
{{Age in years and months|2001|23 Feb 2012|range=no}}
  • {{Age in years and months|2001|23 Feb 2012|range=no}} → 11年
  • {{Age in years and months/sandbox|2001|23 Feb 2012|range=no}} → 11年
  • (assume 23 Feb 2001 to 23 Feb 2012)

測試 5

[編輯]

The sort key is based on the age in days, and fractions of a day if a time is specified.

{{Age in years and months|10 Jan 2001|20 Feb 2012|sortable=debug}}
  • {{Age in years and months|10 Jan 2001|20 Feb 2012|sortable=debug}} → <span style="border:1px solid;display:inline;" class="sortkey">7003405800000000000♠</span>11年1個月
  • {{Age in years and months/sandbox|10 Jan 2001|20 Feb 2012|sortable=debug}} → <span style="border:1px solid;display:inline;" class="sortkey">7003405800000000000♠</span>11年1個月
{{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug}}
  • {{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug}} → <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>11年1個月
  • {{Age in years and months/sandbox|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug}} → <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>11年1個月
{{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug|show=hide}}
  • {{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug|show=hide}} → <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>
  • {{Age in years and months/sandbox|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug|show=hide}} → <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>

測試 6

[編輯]

An extra day is added for a duration.

{{Age in years and months|20 Jan 2001|19 Feb 2012}}
  • {{Age in years and months|20 Jan 2001|19 Feb 2012}} → 11年
  • {{Age in years and months/sandbox|20 Jan 2001|19 Feb 2012}} → 11年
  • (one day short of 11 years, 1 month)
{{Age in years and months|20 Jan 2001|19 Feb 2012|duration=on}}
  • {{Age in years and months|20 Jan 2001|19 Feb 2012|duration=on}} → 11年1個月
  • {{Age in years and months/sandbox|20 Jan 2001|19 Feb 2012|duration=on}} → 11年1個月

測試 7

[編輯]

The least-significant time unit can be rounded.

{{Age in years and months|20 Jan 2001|10 Feb 2012}}
  • {{Age in years and months|20 Jan 2001|10 Feb 2012}} → 11年
  • {{Age in years and months/sandbox|20 Jan 2001|10 Feb 2012}} → 11年
{{Age in years and months|20 Jan 2001|10 Feb 2012|round=on}}
  • {{Age in years and months|20 Jan 2001|10 Feb 2012|round=on}} → 11年1個月
  • {{Age in years and months/sandbox|20 Jan 2001|10 Feb 2012|round=on}} → 11年1個月
  • (round to nearest month)

測試 8

[編輯]

Large numbers can be formatted with commas.

{{Age in years and months|120|2012|format=commas|range=yes}}
  • {{Age in years and months|120|2012|format=commas|range=yes}} → 1,891或1,892年
  • {{Age in years and months/sandbox|120|2012|format=commas|range=yes}} → 1,891或1,892年
{{Age in years and months|120|2012|format=commas|range=dash}}
  • {{Age in years and months|120|2012|format=commas|range=dash}} → 1,891—1,892年
  • {{Age in years and months/sandbox|120|2012|format=commas|range=dash}} → 1,891—1,892年