Difference between revisions of "Template:AgeUnit"

From Second Life Wiki
Jump to navigation Jump to search
m
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly>{{#vardefine:days|{{#expr:(({{ #time: U | {{LOCALDAY2}}.{{LOCALMONTH}}.{{LOCALYEAR}} }} - {{ #time: U | {{{1}}}.{{{2}}}.{{{3}}} }}) /  86400) round 0}}}}{{#ifexpr:{{#var:days}} = 1|1 day|{{#ifexpr:{{#var:days}} < 90|{{#var:days}} days|{{#ifexpr:{{#var:days}} < 730|{{#expr:(({{#var:days}} * 12) / 365.25) round 0}} months|{{#expr:({{#var:days}} / 365.25) round 0}} years}}}}}}</includeonly><noinclude>This template calculates a difference in days between a given date (past 01.01.1970) and the current date. Use it with <nowiki>{{Age|DD|MM|YYYY}}</nowiki>.</noinclude>
<includeonly>{{#vardefine:days|{{#expr:(({{ #time: U | {{LOCALDAY2}}.{{LOCALMONTH}}.{{LOCALYEAR}} }} - {{ #time: U | {{{1}}}.{{{2}}}.{{{3}}} }}) /  86400) round 0}}}}{{#ifexpr:{{#var:days}} = 1|1 day|{{#ifexpr:{{#var:days}} < 90|{{#var:days}} days|{{#ifexpr:{{#var:days}} < 730|{{#expr:(({{#var:days}} * 12) / 365.25) round 0}} months|{{#ifexpr:{{#var:days}} < 7305|{{#expr:({{#var:days}} / 365.25) round 0}} years|{{#expr:({{#var:days}} / 3652.5) round 0}} decades}}}}}}}}</includeonly><noinclude>This template calculates a difference between a given date (past 01.01.1970) and the current date. Use it with <nowiki>{{Age|DD|MM|YYYY}}</nowiki>. It tries to guess what the best unit to use would be.</noinclude>

Latest revision as of 11:23, 14 March 2014

This template calculates a difference between a given date (past 01.01.1970) and the current date. Use it with {{Age|DD|MM|YYYY}}. It tries to guess what the best unit to use would be.