Template:Age in days: Difference between revisions

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
No edit summary
(Undo revision 4409623 by Windy (talk) There already is an example.)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
<includeonly>{{#invoke:age|age_generic|template=age_days}}</includeonly><noinclude>
<includeonly>{{#expr: abs({{#time: U|{{{2|{{#time: F j, Y}}}}}}} - {{#time: U|{{{1|{{#time: F j, Y}}}}}}}) div 86400}}</includeonly><noinclude>
This template returns the number of days between two specified dates. If the second parameter is not included, it will return the number of days between a specified date and today's date.
This template returns the number of days between two specified dates. If the second parameter is not included, it will return the number of days between a specified date and today's date.


Line 8: Line 8:
</pre>
</pre>


<code><nowiki>{{age in days|August 12, 2005}}</nowiki></code> returns "6,910" (as of July 13, 2024)
<code><nowiki>{{age in days|November 23, 1990|August 12, 2005}}</nowiki></code> returns "{{age in days|November 23, 1990|August 12, 2005}}"
 
<code><nowiki>{{age in days|August 12, 2005}}</nowiki></code> returns "{{age in days|August 12, 2005}}"
 
===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 in days|August 12 2005}}</nowiki></code> returns "{{age in days|August 12 2005}}"
:<code><nowiki>{{age in days|12 August 2005}}</nowiki></code> returns "{{age in days|12 August 2005}}"
:<code><nowiki>{{age in days|2005-08-12}}</nowiki></code> returns "{{age in days|2005-08-12}}"
 
==See also==
*[[Template:Age]]


[[Category:Formatting templates]]</noinclude>
[[Category:Formatting templates]]</noinclude>

Latest revision as of 06:49, October 25, 2024

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

Usage

{{age in days|date1}}
{{age in days|date1|date2}}

{{age in days|November 23, 1990|August 12, 2005}} returns "5376"

{{age in days|August 12, 2005}} returns "7203"

Date formatting

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 in days|August 12 2005}} returns "7203"
{{age in days|12 August 2005}} returns "7203"
{{age in days|2005-08-12}} returns "7203"

See also