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.

Editing Template:Birth date and age

Template page
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
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}}}{{#if: {{{death|}}}||<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}}}<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 can calculate the person's current age.
This template formats a birth date and calculates 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:''' `{{Birth date and age|1955|10|28}}` will display "October 28, 1955 (age 69)".
* '''Example:''' <code><nowiki>{{Birth date and age|1955|10|28}}</nowiki></code> 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>
Please note that all contributions to Internet Movie Artifact Database (IMADb) are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Internet Movie Artifact Database (IMADb):Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)