Changes

Template:AgeYears

1,190 bytes added, 18:01, 18 April 2017
Created page with "<includeonly>{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}</i..."
<includeonly>{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}</includeonly><noinclude>
==Description==
Compares two dates and returns difference in years. Mainly used for showing ones age.
===Parameters===
<pre>{{AgeYears
|year1
|month1
|day1

|year2
|month2
|day2
}}</pre>
;year1 (first parameter)
:year to check
;month1 (second parameter)
:month to check
;day1 (third parameter)
:day to check
;year2 (fourth parameter)
:year to compare, current year by default
;month2 (fifth parameter)
:month to compare, current month by default
;day2 (sixth parameter)
:day to compare, current day by default
===Example===
If you want to show how old are you and you were born on (for example) 01-01-1999 use '''<nowiki>{{AgeYears|1999|1|1}}</nowiki>''': that will show '''{{AgeYears|1999|1|1}}'''.

If you want to compare for example two dates to check how old you were on given day (again, lets say you were born on 01-01-1999) use: '''<nowiki>{{AgeYears|1999|1|1|2010|10|3}}</nowiki>''': that will show '''{{AgeYears|1999|1|1|2010|10|3}}'''.

[[Category:Date templates]]</noinclude>
150
edits