Difference between revisions of "Template:Age"

From eRepublik Official Wiki
Jump to: navigation, search
(usage improved)
m
 
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
Age template is used to calculate the time between two dates. If no date, or incomplete date, is selected an error message will show up.
+
{{Documentation}}
 
+
</noinclude><includeonly>{{#if:{{#ifeq:{{{6|¤}}}|¤||1}}{{#ifeq:{{{5|¤}}}|¤||1}}{{#ifeq:{{{4|¤}}}|¤||1}}
To properly calculate date please use the following formula:
+
<pre>{{Age|Older Year|Older Month|Older Day|Newer Year|Newer Month|Newer Day}}</pre>
+
 
+
If only one date is selected it calculates time from today to that date.
+
<pre>{{Age|Year|Month|Day}}</pre>
+
Or you can use day=| month=| year=| in any order you want:
+
<pre>{{Age|month=number of the month|day=number of the day|year=number of the year}}</pre>
+
 
+
'''Please do not use names for months, use numbers.'''
+
 
+
==Examples==
+
<pre>{{Age|1989|7|23}}</pre> → {{Age|1989|7|23}}
+
<pre>{{Age|1989|7|23|2003|7|24}}</pre> → {{Age|1989|7|23|2003|7|24}}
+
<pre>{{Age|2007|03|02|2008|03|02}}</pre> → {{Age|2007|03|02|2008|03|02}}
+
<pre>{{Age|month=01|day=23|year=1989}}</pre> → {{Age|month=01|day=23|year=1989}}
+
<pre>{{Age|year=1989}}</pre> → {{Age|year=1989}}[[Category:Templates]]</noinclude><includeonly>{{#if:{{#ifeq:{{{6|¤}}}|¤||1}}{{#ifeq:{{{5|¤}}}|¤||1}}{{#ifeq:{{{4|¤}}}|¤||1}}
+
 
  |{{#iferror:{{#time:Y-m-d|{{{6}}}-{{{5}}}-{{{4}}}}}
 
  |{{#iferror:{{#time:Y-m-d|{{{6}}}-{{{5}}}-{{{4}}}}}
 
   |{{error|Error: Invalid time. }}
 
   |{{error|Error: Invalid time. }}

Latest revision as of 15:19, 16 July 2021

[edit] [purge]

Documentation

Age template is used to calculate the time between two dates. If no date, or incomplete date, is selected an error message will show up.

Usage

To properly calculate date please use the following formula:

{{Age|Older Year|Older Month|Older Day|Newer Year|Newer Month|Newer Day}}

If only one date is selected it calculates time from today to that date.

{{Age|Year|Month|Day}}

Or you can use day=| month=| year=| in any order you want:

{{Age|month=number of the month|day=number of the day|year=number of the year}}

Please do not use names for months, use numbers.

Examples

{{Age|1989|7|23}}
→ 34 years, 9 months and 29 days
{{Age|1989|7|23|2003|7|24}}
→ 14 years and 1 day
{{Age|2007|03|02|2008|03|02}}
→ 1 year
{{Age|month=01|day=23|year=1989}}
→ 35 years, 3 months and 29 days
{{Age|year=1989}}
→ 34 or 35 years