自2019年9月29日起未验证邮箱的用户将无法编辑页面。请尽快前往参数设置验证邮箱,谢谢您的配合(若您使用中国大陆境内的邮箱,可能存在数小时延迟,请耐心等待;若24小时内未收到,请检查您的垃圾箱

Difference between revisions of "模板:Age"

From Ballance Wiki
Jump to: navigation, search
m
(Tags: Mobile edit, Mobile web edit)
m (Usage:link to wikipedia)
(Tags: Mobile edit, Mobile web edit)
 
Line 22: Line 22:
 
: <code><nowiki>{{</nowiki>age|July 1989|2003}}</code> → {{age|July 1989|2003}}
 
: <code><nowiki>{{</nowiki>age|July 1989|2003}}</code> → {{age|July 1989|2003}}
  
: When entering dates before the [[Common Era]], use astronomical year numbering: 1&nbsp;BCE is represented by <code>0</code>, 2&nbsp;BCE by <code>-1</code>, 3&nbsp;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:
+
: When entering dates before the [[Wikipedia:Common Era|Common Era]], use astronomical year numbering: 1&nbsp;BCE is represented by <code>0</code>, 2&nbsp;BCE by <code>-1</code>, 3&nbsp;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|-215|8|2}}</code> → {{age|-215|8|2}}
 
:: <code><nowiki>{{</nowiki>age|August 2, 216 BCE}}</code> → {{age|August 2, 216 BCE}}
 
:: <code><nowiki>{{</nowiki>age|August 2, 216 BCE}}</code> → {{age|August 2, 216 BCE}}
 
</noinclude>
 
</noinclude>

Latest revision as of 12:54, 10 October 2019

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}}30
{{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}}2234
{{age|August 2, 216 BCE}}2234