Difference between revisions of "Template:Age"

From Hattrick
m (Reverted edits by Brishcanae (Talk) to last revision by Lleida)
Line 1: Line 1:
<includeonly>{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}</includeonly><noinclude>
+
<includeonly>{{#expr:floor{{#expr:{{JULIANDIFF|{{#time:Y}}|{{#time:m}}|{{#time:d}}|{{{1}}}|{{{2}}}|{{{3}}} }} / 112}}}} years and {{#expr:{{JULIANDIFF|{{#time:Y}}|{{#time:m}}|{{#time:d}}|{{{1}}}|{{{2}}}|{{{3}}} }} mod 112}} days</includeonly><noinclude>{{documentation}}</noinclude>
{{documentation}}
 
</noinclude>
 

Revision as of 16:35, 4 July 2011

[edit] Template documentation

Explanation
Calculates the Hattrick time (years and days) that has passed from a date x until now. Typical use: automatical player age display, hence the name. For years only, use Template:AgeYears.
Syntax
{{Age | YEAR | MONTH | DAY }}
Examples
{{Age|2010|10|10}} produces 32 years and 55 days
{{Age|2009|10|10}} produces 35 years and 84 days
{{Age|2008|10|10}} produces 39 years and 1 days
{{Age|2002|10|10}} produces 58 years and 65 days