WikiPartner (talk | contribs) Creating Template:Birth date and age |
WikiPartner (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
<includeonly>{{#if:{{{1|}}}|{{#time:j F Y|{{{1}}}-{{{2 | <includeonly>{{#if:{{{1|}}}|{{#if:{{{2|}}}|{{#if:{{{3|}}}|{{#time:j F Y|{{{1}}}-{{{2}}}-{{{3}}}}} (age {{#expr:{{CURRENTYEAR}}-{{{1}}}-{{#ifexpr:{{CURRENTMONTH}} < {{{2}}}|1|{{#ifexpr:{{CURRENTMONTH}} > {{{2}}}|0|{{#ifexpr:{{CURRENTDAY}} < {{{3}}}|1|0}}}}}}}}})|{{#time:F Y|{{{1}}}-{{{2}}}-01}}}}|{{{1}}}}}}}</includeonly><noinclude> | ||
Displays a birth date | Displays a birth date and, when the complete date is known, the person's current age. | ||
== Usage == | == Usage == | ||
Year only: | |||
<pre> | <pre> | ||
{{Birth date and age| | {{Birth date and age|1998}} | ||
</pre> | </pre> | ||
Year and month: | |||
<pre> | <pre> | ||
{{Birth date and age|1998| | {{Birth date and age|1998|6}} | ||
</pre> | </pre> | ||
Complete date: | |||
<pre> | |||
{{Birth date and age|1998|6|28}} | |||
</pre> | |||
Complete dates display the current age automatically. Partial dates do not show an age because the exact age cannot be determined. | |||
[[Category:Date templates]] | [[Category:Date templates]] | ||
</noinclude> | </noinclude> | ||
Latest revision as of 13:45, 1 September 2026
Displays a birth date and, when the complete date is known, the person's current age.
Usage
Year only:
{{Birth date and age|1998}}
Year and month:
{{Birth date and age|1998|6}}
Complete date:
{{Birth date and age|1998|6|28}}
Complete dates display the current age automatically. Partial dates do not show an age because the exact age cannot be determined.