Contents

Template:Birth date and age: Difference between revisions

Creating Template:Birth date and age
 
No edit summary
 
Line 1: Line 1:
<includeonly>{{#if:{{{1|}}}|{{#time:j F Y|{{{1}}}-{{{2|1}}}-{{{3|1}}}}} (age {{#expr:{{CURRENTYEAR}}-{{{1}}}-{{#ifexpr:{{CURRENTMONTH}} < {{{2|1}}}|1|{{#ifexpr:{{CURRENTMONTH}} > {{{2|1}}}|0|{{#ifexpr:{{CURRENTDAY}} < {{{3|1}}}|1|0}}}}}}}}})}}</includeonly><noinclude>
<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 together with the person's current age.
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|YEAR|MONTH|DAY}}
{{Birth date and age|1998}}
</pre>
</pre>


Example:
Year and month:
<pre>
<pre>
{{Birth date and age|1998|7|15}}
{{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.