模板:Age in years and days/doc
![]() | 此頁面是Template:Age in years and days的模板文件。 此頁面可能包含了模板的使用說明、分類和其他內容。 |
This template returns the number of full years and surplus days between two specified dates. If only one date is entered, the template returns the number of full years and surplus days between the specified date and today's date.
This template does not generate a sort key. In a Help:可排序表格, use {{ayd}} which redirects to {{age in years and days nts}}.
用法
編輯Each date can be entered in a single parameter, or each date can be entered as three parameters: year, month, day.
{{age in years and days|15 May 2010}}
→ 14歲94天{{age in years and days|12 Aug 2003|24 Sep 2011}}
→ 8歲43天{{age in years and days|1989|7|23}}
→ 35歲25天{{age in years and days|1989|7|23|2003|7|24}}
→ 14歲1天{{age in years and days|2007|03|02|2008|03|02}}
→ 1歲0天{{age in years and days|1999|11|07|2112|02|15}}
→ 112歲100天
An error is shown if an entered date is not valid (1800, 1900 and 2100 were not a leap year).
{{age in years and days|31 January 1892|29 February 1900}}
→ Error: Second date should be year, month, day
設定顯示格式
編輯可通過參數age來更改顯示格式:
- age=yes時,顯示為××歲××天
- age=no時,顯示為××年××天
- 省略時,顯示為××歲××天
選項
編輯The default is to separate years and days with a comma. The separator is "and" if |sep=and
is used.
The default calculates an age—the day of the second date is not included in the calculation. A duration including the second date is calculated if |duration=on
is used.
{{age in years and days|1 Jan 2011|31 Dec 2012}}
→ 1歲365天{{age in years and days|1 Jan 2011|31 Dec 2012|sep=and}}
→ 1歲,365天{{age in years and days|1 Jan 2011|31 Dec 2012|duration=on}}
→ 2歲0天
|