模板:Birth year and age/doc

维基百科,自由的百科全书
跳转到导航 跳转到搜索

用法[编辑]

本模版{{Birth year and age}}和{{Death year and age}}显示一个人的出生或逝世年份与大概年龄。如果要完整显示出生或逝世年月日,请使用{{Birth date and age}}和{{Death date and age}}。

本页说明全部范例所使用的今天日期是
2026年6月23日

{{Birth year and age}}[编辑]

假设:

  1. 某人的出生年份是1971年
  2. 今天是2026年6月23日
  • 如果这个人是在1971年6月23日之后出生,那么他在今天(2026年6月23日)还没有过今年的生日,于是他就只是54岁。但是如果他是在1971年6月23日或之前出生,那么他就是55岁。
所以使用本模版{{birth year and age|1971}}时,
他的出生年份与年龄是:1971年(54—55岁)
  • 另外,如果我们知道这个人的出生月份,我们也可以使用本模版。
假设这个人出生的年月份是1971年6月,那么:
  • 如果现在是2026年1月,即是说这个人今年还没有过生日。所以使用本模版{{birth year and age|1971|6}} 时,他的出生年月份与年龄是:1971年6月(54岁)。
  • 如果现在是2026年6月,我们并不知道他是否过了生日(因为我们不知道他哪一天出生)。所以本模版就会显示他的出生年份与年龄是:1971年6月(54-55岁)。
  • 如果现在是2026年12月,即是说这个人今年已经过了生日。所以使用本模版时,他的出生年份与年龄是:1971年6月(55岁)。

{{Death year and age}}[编辑]

假设:

  1. 某人的出生年份是1975年
  2. 他于2025年某日逝世
  • 我们可以分开为两个例子:(1)某人出生于1975年12月31日,于2025年1月1日逝世,那么他还没有过在2025年12月31日的生日,于是他就只是49岁;(2)某人出生于1975年1月1日,于2025年12月31日逝世,那么他已经过了在2025年1月1日的生日,于是他就是50岁。
所以使用本模版{{Death year and age|2025|1975}}时,
他的逝世年份与年龄是:2025年(49—50岁)
  • 另外,如果我们知道这个人的逝世月份,我们也可以使用本模版。
使用上述例子,假设这个人的逝世月份是06(6月)
所以使用本模版{{Death year and age|2025|1975|06}}时,
他的逝世年份与年龄是:2025年6月(49—50岁)

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|出生年份|出生月份(可省略)}}
{{Death year and age|逝世年份|出生年份}}
{{Death year and age|逝世年份|出生年份|逝世月份(可省略)}}

范例[编辑]

源代码 结果
{{Birth year and age|1971}} 1971年(54—55岁)
{{Birth year and age|1971|06}} 1971年6月(54—55岁)
{{Death year and age|2025|1975}} 2025年(49—50岁)
{{Death year and age|2025|1975|06}} 2025年6月(49—50岁)

参见[编辑]


<templatedata> { "params": { "year": { "label": "出生年份", "description": "请填写四位数的阿拉伯数字,不须加上“年”", "example": "1970", "type": "number", "required": true }, "month": { "label": "出生月份", "description": "请填写阿拉伯数字,不须加上“月”", "type": "number", "suggested": true }, "day": { "label": "出生日", "description": "请填写阿拉伯数字,不须加上“日”", "type": "number", "suggested": true } }, "description": "显示出生日期,并在其后自动计算并加注今年的年龄。", "paramOrder": [ "year", "month", "day" ] } </templatedata>