Template:Age: Difference between revisions

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
No edit summary
No edit summary
Line 3: Line 3:


;Syntax<nowiki>:</nowiki>
;Syntax<nowiki>:</nowiki>
:<nowiki>{{age|date1|date2}}</nowiki> or  
:<nowiki>{{age|date1|date2}}</nowiki> or
:<nowiki>{{age|date1}}</nowiki>
:<nowiki>{{age|date1}}</nowiki>


; Examples<nowiki>:</nowiki>
;Examples<nowiki>:</nowiki>
: <nowiki>{{age|July 7, 1989|July 14, 2003}}</nowiki> returns "{{age|July 7, 1989|July 14, 2003}}"
:<nowiki>{{age|July 7, 1989|July 14, 2003}}</nowiki> returns "{{age|July 7, 1989|July 14, 2003}}"
: <nowiki>{{age|July 7, 1989}}</nowiki> returns "{{age|July 7, 1989}}"
:<nowiki>{{age|July 7, 1989}}</nowiki> returns "{{age|July 7, 1989}}"


: The full range of possible date formats is based on php's strtotime() function and is explained [https://www.php.net/manual/en/datetime.formats.php here], but for simplicity it's usually best to just stick to the format above.
:The full range of possible date formats is based on php's strtotime() function and is explained [https://www.php.net/manual/en/datetime.formats.php here], but for simplicity it's usually best to just stick to the format above.
:: <nowiki>{{age|July 7 1989}}</nowiki> returns "{{age|July 7 1989}}"
::<nowiki>{{age|July 7 1989}}</nowiki> returns "{{age|July 7 1989}}"
:: <nowiki>{{age|7 July 1989}}</nowiki> returns "{{age|7 July 1989}}"
::<nowiki>{{age|7 July 1989}}</nowiki> returns "{{age|7 July 1989}}"
:: <nowiki>{{age|1989-7-23}}</nowiki> returns "{{age|1989-7-23}}"
::<nowiki>{{age|1989-7-23}}</nowiki> returns "{{age|1989-7-23}}"


: 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.
;Note<nowiki>:</nowiki>
:: Example: <nowiki>{{subst:age|July 7, 1989|July 14, 2003}}</nowiki>
:This template does not check for incorrect input.
 
; Note<nowiki>:</nowiki>
:This template does not check for incorrect input:
:: <nowiki>{{age|1980-7-14|1993-6-233}}</nowiki> returns "{{age|1980-7-14|1993-6-233}}" (surplus days do not count as extra months)
:: <nowiki>{{age|1980-7-14|1993-88-14}}</nowiki> returns "{{age|1980-7-14|1993-88-14}}" (surplus months do not count as extra years)


[[Category:Formatting templates]]</noinclude>
[[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|July 7, 1989|July 14, 2003}} returns "14"
{{age|July 7, 1989}} returns "35"
The full range of possible date formats is based on php's strtotime() function and is explained here, but for simplicity it's usually best to just stick to the format above.
{{age|July 7 1989}} returns "35"
{{age|7 July 1989}} returns "35"
{{age|1989-7-23}} returns "35"
Note:
This template does not check for incorrect input.