Template:Age: Difference between revisions

From Rhythm Heaven Wiki
Jump to navigation Jump to search
(Created page with "<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> 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 betwe...")
 
(Documentation moved to Template:Age/doc, use {{doc}} to show it)
 
Line 1: Line 1:
<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>
<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>{{doc}}</noinclude>
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.
 
==Usage==
<pre>
{{age|date1}}
{{age|date1|date2}}
</pre>
 
<code><nowiki>{{age|August 3, 1990}}</nowiki></code> returns "{{age|August 3, 1990}}"
 
<code><nowiki>{{age|August 3, 1990|June 11, 2006}}</nowiki></code> returns "{{age|August 3, 1990|June 11, 2006}}"
 
===Date formatting===
The full range of possible date formats is based on php's <code>strtotime()</code> 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.
:<code><nowiki>{{age|August 3 1990}}</nowiki></code> returns "{{age|August 3 1990}}"
:<code><nowiki>{{age|3 August 1990}}</nowiki></code> returns "{{age|3 August 1990}}"
:<code><nowiki>{{age|1990-08-03}}</nowiki></code> returns "{{age|1990-08-03}}"
 
===Source===
This template is borrowed from the [[mariowiki:Template:Age|Super Mario Wiki]]. Thanks!
[[Category:Formatting templates]]</noinclude>

Latest revision as of 05:01, 31 August 2025

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.

Usage

{{age|date1}}
{{age|date1|date2}}
  • {{age|August 3, 1990}} → "35"
  • {{age|August 3, 1990|June 11, 2006}} → "15"

Date formatting

The full range of possible date formats is based on php's strtotime() function, but for simplicity it's usually best to just stick to the format above.

  • {{age|August 3 1990}} → "35"
  • {{age|3 August 1990}} → "35"
  • {{age|1990-08-03}} → "35"

Attribution

Epilogue Wii Cheer Readers 2 HI.png