模板:Birth year and age/doc
跳到导航
跳到搜索
![]() | 此页面是Template:Birth year and age的模板文档。 此页面可能包含了模板的使用说明、分类和其他内容。 |
用法[编辑源代码]
本模版{{Birth year and age}}显示一个人的出生年份与大概年龄。如果要完整显示出生年月日,请使用{{Birth date and age}}。
年龄算法说明[编辑源代码]
假设:
- 某人的出生年份是1959年
- 今天是2023年3月28日
- 如果这个人是在1959年3月28日之后出生,那么他在今天(2023年3月28日)还没有过今年的生日,于是他就只是63岁。但是如果他是在1959年3月28日或之前出生,那么他就是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|03}} | 1968年03月(54-55岁) |
{{Birth year and age|1968|2}} | 1968年2月(55岁) |
{{Birth year and age|1968|4}} | 1968年4月(54岁) |
参见[编辑源代码]
- {{Birth date}}
- {{Birth date and age}}
- {{Death date and age}}
- {{Age}}
- {{Age at date}}