Difference between revisions of "Template:Age"
Jump to navigation
Jump to search
(Created page with "{{#expr: {{#time:Y |now + 61 years}} - {{{Year}}} - {{#ifexpr: {{#time:m |now + 61 years}} < {{{Month}}} | 1 | {{#ifexpr: {{#time:d |now + 61 years}} < {{{Day}}} | 1 | 0 }} }} }}") Tag: visualeditor-wikitext |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{#expr: {{#time:Y |now + 61 years}} - {{{Year}}} - {{#ifexpr: {{#time:m |now + 61 years}} < {{{Month}}} | 1 | {{#ifexpr: {{#time:d |now + 61 years}} < {{{Day}}} | 1 | 0 }} }} }} | <includeonly>{{#if: {{{Year}}} | {{#expr: {{#time:Y |now + 61 years}} - {{{Year}}} - {{#ifexpr: {{#time:m |now + 61 years}} < {{{Month|1}}} | 1 | {{#ifexpr: {{#time:m |now + 61 years}} > {{{Month|1}}} | 0 | {{#ifexpr: {{#time:d |now + 61 years}} < {{{Day|1}}} | 1 | 0 }} }} }} }} }} | ||
</includeonly> | |||
<noinclude> | |||
{| cellpadding=5 cellspacing=0 style="border: gray 2px solid; width: 100%; -moz-border-radius: 20px; -webkit-border-radius: 25px; border-radius: 25px; background-color: #444" | |||
|- | |||
| | |||
==Usage== | |||
This template allows you to put in a character's date of birth, and it will automatically calculate their age based on the current in-game date. The following requirements apply: | |||
* All entries including Month must be in numeric format. | |||
* Year must be the full, 4 digit year. | |||
So, if you enter this: | |||
<pre> | |||
{{Age| | |||
|Month=9 | |||
|Day=29 | |||
|Year=20 | |||
|}} | |||
</pre> | |||
The template will return the current age of {{Age| | |||
|Month=8 | |||
|Day=26 | |||
|Year=2053 | |||
|}} | |||
The Month and Day field are both optional, if they are missing, the template will assume January and the 1st of the month. If you wish, you only need to enter a year. | |||
If the year is not present, the template will return nothing. | |||
[[Category:Templates]] | |||
[[Category:Character Page Templates]] | |||
[[Category:Contact Templates]] | |||
|} | |||
</noinclude> |
Latest revision as of 17:09, 24 September 2024
UsageThis template allows you to put in a character's date of birth, and it will automatically calculate their age based on the current in-game date. The following requirements apply:
So, if you enter this: {{Age| |Month=9 |Day=29 |Year=20 |}} The template will return the current age of 32
If the year is not present, the template will return nothing. |