User:2257/Test: Difference between revisions

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
{{#ifexpr: {{#iferror: {{#expr: {{#time:U|{{{unlock|}}}}} - {{#time: U}} < 0 }} | 0 | {{#ifexpr: ( {{#time:U|{{{unlock|}}}}} - {{#time: U}} < 0 ) and {{#if:{{{unlock|}}}|1|0}} | 1 | 0 }}}} |
<includeonly>{{#expr:({{#time:Y|{{{2|{{CURRENTTIMESTAMP}}}}}}})-({{#time:Y|{{{1}}}}})-(({{#time:m|{{{2|{{CURRENTTIMESTAMP}}}}}}})<({{#time:m|{{{1}}}}})or({{#time:m|{{{2|{{CURRENTTIMESTAMP}}}}}}})=({{#time:m|{{{1}}}}})and({{#time:d|{{{2|{{CURRENTTIMESTAMP}}}}}}})<({{#time:d|{{{1}}}}}))}}</includeonly><noinclude>
{{{2}}}
This template returns the number of full years between two specified dates. If the second parameter is not included, it will return the number of full years between a specified date and today's date.
<includeonly>[[Category:Expired spoilers]]</includeonly>
 
|
;Syntax<nowiki>:</nowiki>
<div class="mw-collapsible mw-collapsed" style="border-left: 2px solid #81405e; padding-left: 0.5em; background:linear-gradient(rgba(252, 101, 198, 0.2), rgba(252, 101, 198, 0.05) 5em);><div class=notice-template style="padding: 0.6em calc(1em + 2%) 0.6em;">
:<nowiki>{{age|date1|date2}}</nowiki>  or
<p>This section contains leaked information regarding '''{{{1}}}'''. </p>{{#iferror: {{#expr: {{#time:U|{{{unlock|}}}}} - {{#time: U}} < 0 }} | <strong class=error style="display: block;">Template error: please give a valid date for the value of the unlock parameter, or remove it.</strong> | {{#if:{{{unlock|}}}|<div style="font-size:smaller">This warning will expire on {{{unlock|}}}</div>}}}}</div><div class=mw-collapsible-content>{{{2}}}</div></div>
:<nowiki>{{age|date1}}</nowiki>
}}
 
; Examples<nowiki>:</nowiki>
: <nowiki>{{age|1989-7-23|2003-7-14}}</nowiki> returns "{{User:2257/Test|1989-7-23|2003-7-14}}"
: <nowiki>{{age|1989-7-23}}</nowiki> returns "{{User:2257/Test|1989-7-23}}"
: <nowiki>{{age|July 7 1989}}</nowiki> returns "{{User:2257/Test|July 7 1989}}"
: <nowiki>{{age|July 7, 1989}}</nowiki> returns "{{User:2257/Test|July 7, 1989}}"
: <nowiki>{{age|7 July 1989}}</nowiki> returns "{{User:2257/Test|7 July 1989}}"
 
: When using this template to calculate a person's age at death or a person's age on a specified date (rather than the person's current age), please substitute it into the page.
:: Example: <nowiki>{{subst:age|1989-7-23|2003-7-14}}</nowiki>
 
; Note<nowiki>:</nowiki>
:This template does not check for incorrect input:
:: <nowiki>{{age|1980-7-14|1993-6-233}}</nowiki> returns "{{User:2257/Test|1980-7-14|1993-6-233}}" (surplus days do not count as extra months)
:: <nowiki>{{age|1980-7-14|1993-88-14}}</nowiki> returns "{{User:2257/Test|1980-7-14|1993-88-14}}" (surplus months do not count as extra years)
 
[[Category:Formatting templates]]</noinclude>

Revision as of 09:22, February 8, 2021

This template returns the number of full years between two specified dates. If the second parameter is not included, it will return the number of full years between a specified date and today's date.

Syntax:
{{age|date1|date2}} or
{{age|date1}}
Examples:
{{age|1989-7-23|2003-7-14}} returns "13"
{{age|1989-7-23}} returns "34"
{{age|July 7 1989}} returns "34"
{{age|July 7, 1989}} returns "34"
{{age|7 July 1989}} returns "34"
When using this template to calculate a person's age at death or a person's age on a specified date (rather than the person's current age), please substitute it into the page.
Example: {{subst:age|1989-7-23|2003-7-14}}
Note:
This template does not check for incorrect input:
{{age|1980-7-14|1993-6-233}} returns "Expression error: Unexpected < operator." (surplus days do not count as extra months)
{{age|1980-7-14|1993-88-14}} returns "Expression error: Unexpected < operator." (surplus months do not count as extra years)