模板:Birth year and age

来自戏曲百科
💬 模板文档[查看] [编辑] [历史] [清除]

用法

本模版{{Birth year and age}}和{{Death year and age}}顯示一個人的出生或逝世年份與大概年齡。如果要完整顯示出生或逝世年月日,請使用{{Birth date and age}}和{{Death date and age}}。

本頁說明全部範例所使用的今天日期是
2023年9月15日

{{Birth year and age}}

假設:

  1. 某人的出生年份是1968年
  2. 今天是2023年9月15日
  • 如果這個人是在1968年9月15日之後出生,那麼他在今天(2023年9月15日)還沒有過今年的生日,於是他就只是54歲。但是如果他是在1968年9月15日或之前出生,那麼他就是55歲。
所以使用本模版{{birth year and age|1968}}時,
他的出生年份與年齡是:1968年(54-55岁)
  • 另外,如果我們知道這個人的出生月份,我們也可以使用本模版。
假設這個人出生的年月份是1968年6月,那麼:
  • 如果現在是2023年1月,即是說這個人今年還沒有過生日。所以使用本模版{{birth year and age|1968|6}} 時,他的出生年月份與年齡是:1968年6月(54歲)。
  • 如果現在是2023年6月,我們並不知道他是否過了生日(因為我們不知道他哪一天出生)。所以本模版就會顯示他的出生年份與年齡是:1968年6月(54-55歲)。
  • 如果現在是2023年12月,即是說這個人今年已經過了生日。所以使用本模版時,他的出生年份與年齡是:1968年6月(55歲)。

{{Death year and age}}

假設:

  1. 某人的出生年份是1972年
  2. 他於2022年某日逝世
  • 我們可以分開為兩個例子:(1)某人出生於1972年12月31日,於2022年1月1日逝世,那麼他還沒有過在2022年12月31日的生日,於是他就只是49歲;(2)某人出生於1972年1月1日,於2022年12月31日逝世,那麼他已經過了在2022年1月1日的生日,於是他就是50歲。
所以使用本模版{{Death year and age|2022|1972}}時,
他的逝世年份與年齡是:模板:Death year and age
  • 另外,如果我們知道這個人的逝世月份,我們也可以使用本模版。
使用上述例子,假設這個人的逝世月份是09(9月)
所以使用本模版{{Death year and age|2022|1972|09}}時,
他的逝世年份與年齡是:模板:Death year and age

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|1968}} 1968年(54-55岁)
{{Birth year and age|1968|09}} 1968年9月(54-55岁)
{{Death year and age|2022|1972}} 模板:Death year and age
{{Death year and age|2022|1972|09}} 模板:Death year and age

參見