Template:Age: Difference between revisions
Appearance
New template: age calculation |
Treat blank birth day as 1 (avoid expression error) |
||
| Line 1: | Line 1: | ||
<includeonly>{{#if:{{{2|}}}|{{#expr:({{{4|{{#time:Y}}}}})-({{{1}}})-((({{{5|{{#time:n}}}}})<({{{2}}})) or ((({{{5|{{#time:n}}}}})=({{{2}}})) and (({{{6|{{#time:j}}}}})<({{{3|1 | <includeonly>{{#if:{{{2|}}}|{{#expr:({{{4|{{#time:Y}}}}})-({{{1}}})-((({{{5|{{#time:n}}}}})<({{{2}}})) or ((({{{5|{{#time:n}}}}})=({{{2}}})) and (({{{6|{{#time:j}}}}})<({{#if:{{{3|}}}|{{{3}}}|1}}))))}}|{{#expr:({{{4|{{#time:Y}}}}})-({{{1}}})-1}}–{{#expr:({{{4|{{#time:Y}}}}})-({{{1}}})}}}}</includeonly><noinclude> | ||
Calculates age in full years. | Calculates age in full years. | ||
Latest revision as of 18:29, 21 November 2026
Calculates age in full years.
Usage: {{Age|birth year|birth month|birth day|end year|end month|end day}} (Gregorian dates). If the end date is omitted, today's date is used, so the age updates automatically. If the birth month is omitted, a range is shown (e.g. 77–78).