Template:Birth year and age/doc
| File:Edit-copy green.svg | 此頁面是Template:Birth year and age的Template文档。 此頁面可能包含了模板的使用說明、分類和其他内容。 |
| 警告 | 此Template文档被引用於約8,800個頁面。 為了避免造成大規模的影響,所有對此Template文档的編輯應先於沙盒、測試樣例或您的沙盒上測試。 測試後無誤的版本可以一次性地加入此Template文档中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
用法[编辑]
本模版{{Birth year and age}}和{{Death year and age}}顯示一個人的出生或逝世年份與大概年齡。如果要完整顯示出生或逝世年月日,請使用{{Birth date and age}}和{{Death date and age}}。
{{Birth year and age}}[编辑]
假設:
- 某人的出生年份是1971年
- 今天是2026年7月12日
- 如果這個人是在1971年7月12日之後出生,那麼他在今天(2026年7月12日)還沒有過今年的生日,於是他就只是54歲。但是如果他是在1971年7月12日或之前出生,那麼他就是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歲)。
- 如果現在是2026年1月,即是說這個人今年還沒有過生日。所以使用本模版
- 假設這個人出生的年月份是1971年6月,那麼:
{{Death year and age}}[编辑]
假設:
- 某人的出生年份是1975年
- 他於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歲)
- 所以使用本模版
- 另外,如果我們知道這個人的逝世月份,我們也可以使用本模版。
- 使用上述例子,假設這個人的逝世月份是07(7月)
- 所以使用本模版
{{Death year and age|2025|1975|07}}時, - 他的逝世年份與年齡是:2025年7月(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|07}} | 1971年7月(54—55歲) |
| {{Death year and age|2025|1975}} | 2025年(49—50歲) |
| {{Death year and age|2025|1975|07}} | 2025年7月(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>