“模板:Age”的版本间的差异
BallanceBug(讨论 | 贡献) (创建页面,内容为“{{#invoke:age|age_generic|template=age_full_years}}”) (2个标签:移动版编辑、移动网页编辑) |
BallanceBug(讨论 | 贡献) 小 (→Usage:link to wikipedia) (2个标签:移动版编辑、移动网页编辑) |
||
(未显示同一用户的1个中间版本) | |||
第1行: | 第1行: | ||
− | {{#invoke:age|age_generic|template=age_full_years}} | + | {{#invoke:age|age_generic|template=age_full_years}}<noinclude> |
+ | == Usage == | ||
+ | |||
+ | This template returns the number of full years between two specified dates. If the second set of parameters is not included, it returns the number of full years between a specified date and today's date. | ||
+ | |||
+ | Dates are checked for validity. For example, 29 February 2000 is accepted, but 29 February 1900 is not a valid date. | ||
+ | |||
+ | Partial dates such as July 1989 (no day) or 1989 (no month and no day) can be entered using <code>0</code> for missing values. Having no year, or having a day with no month is an error. | ||
+ | |||
+ | ; Syntax: | ||
+ | : <code><nowiki>{{</nowiki>age|''year''|''month''|''day''|''year2''|''month2''|''day2''}}</code> or | ||
+ | : <code><nowiki>{{</nowiki>age|''year''|''month''|''day''}}</code> or | ||
+ | : <code><nowiki>{{</nowiki>age|''date''|''date2''}}</code> or | ||
+ | : <code><nowiki>{{</nowiki>age|''date''}}</code> | ||
+ | |||
+ | ; Examples: | ||
+ | : <code><nowiki>{{</nowiki>age|1989|7|23|2003|7|14}}</code> → {{age|1989|7|23|2003|7|14}} | ||
+ | : <code><nowiki>{{</nowiki>age|1989|7|0|2003|7|14}}</code> → {{age|1989|7|0|2003|7|14}} | ||
+ | : <code><nowiki>{{</nowiki>age|1989|0|0|2003|7|14}}</code> → {{age|1989|0|0|2003|7|14}} | ||
+ | : <code><nowiki>{{</nowiki>age|1989|7|23}}</code> → {{age|1989|7|23}} | ||
+ | : <code><nowiki>{{</nowiki>age|23 July 1989|14 July 2003}}</code> → {{age|23 July 1989|14 July 2003}} | ||
+ | : <code><nowiki>{{</nowiki>age|July 1989|2003}}</code> → {{age|July 1989|2003}} | ||
+ | |||
+ | : When entering dates before the [[Wikipedia:Common Era|Common Era]], use astronomical year numbering: 1 BCE is represented by <code>0</code>, 2 BCE by <code>-1</code>, 3 BCE by <code>-2</code> etc. For example, the following gives the number of full years since the battle of Cannae, which took place on August 2, 216 BCE: | ||
+ | :: <code><nowiki>{{</nowiki>age|-215|8|2}}</code> → {{age|-215|8|2}} | ||
+ | :: <code><nowiki>{{</nowiki>age|August 2, 216 BCE}}</code> → {{age|August 2, 216 BCE}} | ||
+ | </noinclude> |
2019年10月10日 (四) 12:54的最新版本
0
Usage
This template returns the number of full years between two specified dates. If the second set of parameters is not included, it returns the number of full years between a specified date and today's date.
Dates are checked for validity. For example, 29 February 2000 is accepted, but 29 February 1900 is not a valid date.
Partial dates such as July 1989 (no day) or 1989 (no month and no day) can be entered using 0
for missing values. Having no year, or having a day with no month is an error.
- Syntax
{{age|year|month|day|year2|month2|day2}}
or{{age|year|month|day}}
or{{age|date|date2}}
or{{age|date}}
- Examples
{{age|1989|7|23|2003|7|14}}
→ 13{{age|1989|7|0|2003|7|14}}
→ 14{{age|1989|0|0|2003|7|14}}
→ 14{{age|1989|7|23}}
→ 35{{age|23 July 1989|14 July 2003}}
→ 13{{age|July 1989|2003}}
→ 14
- When entering dates before the Common Era, use astronomical year numbering: 1 BCE is represented by
0
, 2 BCE by-1
, 3 BCE by-2
etc. For example, the following gives the number of full years since the battle of Cannae, which took place on August 2, 216 BCE:{{age|-215|8|2}}
→ 2239{{age|August 2, 216 BCE}}
→ 2239