Difference between revisions of "Template:Age in decimal years"
Jump to navigation
Jump to search
blackwiki>Ahecht (use suffix= instead) |
blackwiki>Ahecht (parentheses) |
||
| Line 1: | Line 1: | ||
| − | {{#if:{{{1|}}}|{{#if:{{{3|}}}|{{#expr:({{#time: U |{{{4|{{#time: Y }}}}}-{{{5|{{#time: m }}}}}-{{{6|{{#time: d }}}}}}}-{{#time: U |{{{1}}}-{{{2|}}}-{{{3|}}}}})/31556952 round {{{round|1}}}}}|{{#expr:({{#time: U |{{{2|{{#time: Y-m-d }}}}}}}-{{#time: U |{{{1}}}}})/31556952 round {{{round|1}}}}}}}|0}} {{{suffix|years}}}<noinclude> | + | {{#if:{{{1|}}}|{{#if:{{{3|}}}|{{#expr:(({{#time: U |{{{4|{{#time: Y }}}}}-{{{5|{{#time: m }}}}}-{{{6|{{#time: d }}}}}}}-{{#time: U |{{{1}}}-{{{2|}}}-{{{3|}}}}})/31556952) round {{{round|1}}}}}|{{#expr:(({{#time: U |{{{2|{{#time: Y-m-d }}}}}}}-{{#time: U |{{{1}}}}})/31556952) round {{{round|1}}}}}}}|0}} {{{suffix|years}}}<noinclude> |
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> | ||
Revision as of 19:55, 8 October 2018
0 years
Usage
Displays age in years and fractions of years. Dates can be entered in the format:
{{A.y|Start year|Start month|Start day|End year|End month|End day}}
or
{{A.y|Start date|End date}}
The |round= parameter can be used to set the number of decimal places shown (defaults to 1).
The |suffix= parameter can be used to set the suffix after the number (defaults to "years").
Examples
{{a.y|15 May 2010}}→ Template:A.y{{a.y|12 Aug 2003|24 Sep 2011}}→ Template:A.y{{a.y|1989|7|23}}→ Template:A.y{{a.y|1989|7|23|2003|7|24}}→ Template:A.y{{a.y|1989|7|23|2003|7|24|round=3}}→ Template:A.y{{a.y|2007|03|02|2008|03|02|suffix=yr}}→ Template:A.y
See also
| The above documentation is transcluded from Template:Age in decimal years/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |