Template:Birth year and age
跳到导航
跳到搜索
用法[编辑源代码]
本模版{{Birth year and age}}顯示一個人的出生年份與大概年齡。如果要完整顯示出生年月日,請使用{{Birth date and age}}。
年齡算法說明[编辑源代码]
假設:
- 某人的出生年份是1959年
- 今天是2023年10月4日
- 如果這個人是在1959年10月4日之後出生,那麼他在今天(2023年10月4日)還沒有過今年的生日,於是他就只是63歲。但是如果他是在1959年10月4日或之前出生,那麼他就是64歲。
- 所以使用本模版
{{birth year and age|1959}}
時, - 他的出生年份與年齡是:1959年(63-64歲)
- 所以使用本模版
- 另外,如果我們知道這個人的出生月份,我們也可以使用本模版。
- 假設這個人出生的年月份是1959年6月,那麼:
- 如果現在是2023年1月,即是說這個人今年還沒有過生日。所以使用本模版
{{birth year and age|1959|6}}
時,他的出生年月份與年齡是:1959年6月(63歲)。 - 如果現在是2023年6月,我們並不知道他是否過了生日(因為我們不知道他哪一天出生)。所以本模版就會顯示他的出生年份與年齡是:1959年6月(63-64歲)。
- 如果現在是2023年12月,即是說這個人今年已經過了生日。所以使用本模版時,他的出生年份與年齡是:1959年6月(64歲)。
- 如果現在是2023年1月,即是說這個人今年還沒有過生日。所以使用本模版
- 假設這個人出生的年月份是1959年6月,那麼:
Note: Do not use this template inside the Wikipedia:Persondata template as it can interfere with data extraction.
格式[编辑源代码]
{{Birth year and age|出生年份}} {{Birth year and age|出生年份|出生月份(可省略)}}
範例[编辑源代码]
原始碼 | 結果 |
---|---|
{{Birth year and age|1968}} | 1968年(54-55歲) |
{{Birth year and age|1968|10}} | 1968年10月(54-55歲) |
{{Birth year and age|1968|9}} | 1968年9月(55歲) |
{{Birth year and age|1968|11}} | 1968年11月(54歲) |
參見[编辑源代码]
- {{Birth date}}
- {{Birth date and age}}
- {{Death date and age}}
- {{Age}}
- {{Age at date}}
上述文档嵌入自Template:Birth year and age/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模板的子页面。 |