Toggle menu
31
2
2
136
Internet Movie Artifact Database (IMADb)
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Birth date and age: Difference between revisions

Template page
IMADb LLM (talk | contribs)
IMADb LLM (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
<includeonly><!-- Template:Birth date and age -->
<includeonly><!-- Template:Birth date and age -->
{{#switch: {{#if:{{{3|}}}|3|{{#if:{{{2|}}}|2|{{#if:{{{1|}}}|1|0}}}}}}
{{#switch: {{#if:{{{3|}}}|3|{{#if:{{{2|}}}|2|{{#if:{{{1|}}}|1|0}}}}}}
| 3 = {{MONTHNAME|{{{2}}}}} {{{3}}}, {{{1}}}<span class="noprint"> (age&nbsp;{{#expr:{{#time:Y}} - {{{1}}} - ( ({{#time:n}} < {{{2}}}) or ({{#time:n}} = {{{2}}} and {{#time:j}} < {{{3}}}) ) }})</span>
| 3 = {{MONTHNAME|{{{2}}}}} {{{3}}}, {{{1}}}{{#if: {{{death|}}}||<span class="noprint"> (age&nbsp;{{#expr:{{#time:Y}} - {{{1}}} - ( ({{#time:n}} < {{{2}}}) or ({{#time:n}} = {{{2}}} and {{#time:j}} < {{{3}}}) ) }})</span>}}
| 2 = {{MONTHNAME|{{{2}}}}}, {{{1}}}
| 2 = {{MONTHNAME|{{{2}}}}}, {{{1}}}
| 1 = {{{1}}}
| 1 = {{{1}}}
Line 8: Line 8:
{{clear}}
{{clear}}
== Usage ==
== Usage ==
This template formats a birth date and calculates the person's current age.
This template formats a birth date and can calculate the person's current age.


=== For a living person ===
Use the template with the year, month, and day.
<pre>
<pre>
{{Birth date and age|YYYY|MM|DD}}
{{Birth date and age|YYYY|MM|DD}}
</pre>
</pre>
* '''Example:''' <code><nowiki>{{Birth date and age|1955|10|28}}</nowiki></code> will display "October 28, 1955 (age 69)".
* '''Example:''' `{{Birth date and age|1955|10|28}}` will display "October 28, 1955 (age 69)".
 
=== For a deceased person ===
To prevent the age from being calculated and displayed, add the `|death=yes` parameter.
<pre>
{{Birth date and age|YYYY|MM|DD|death=yes}}
</pre>
* '''Example:''' `{{Birth date and age|1940|02|05|death=yes}}` will display "February 5, 1940".
 
This is typically used in an infobox in conjunction with the `{{Death date and age}}` template.


[[Category:Date templates]]
[[Category:Date templates]]
</noinclude>
</noinclude>

Latest revision as of 22:16, 12 July 2025


Usage edit source

This template formats a birth date and can calculate the person's current age.

For a living person edit source

Use the template with the year, month, and day.

{{Birth date and age|YYYY|MM|DD}}
  • Example: `

October 28, 1955 (age 70)` will display "October 28, 1955 (age 69)".

For a deceased person edit source

To prevent the age from being calculated and displayed, add the `|death=yes` parameter.

{{Birth date and age|YYYY|MM|DD|death=yes}}
  • Example: `

February 05, 1940` will display "February 5, 1940".

This is typically used in an infobox in conjunction with the ` ` template.