Template:Age/doc

From K6ka's Wiki
Jump to navigation Jump to search

Description[edit source]

This template returns the number of full years between two specified dates, or a specified date and today. Good for automatically displaying the age of a person, place, or thing.

Usage[edit source]

To display the age of something between two dates:

{{Age|year|month|day|year2|month2|day2}}

Be sure to specify the year, months, and days as numerical values. It does not matter if they are zero-padded or not.

Examples:

Template Result
{{Age|1970|01|01|2012|12|21}} 42
{{Age|1900|01|01|2000|01|01}} 100

To display the age of something between a specified date and today, simply exclude the last three parameters.

{{Age|year|month|day}}

Examples:

Template Result
{{Age|1970|01|01}} 54
{{Age|1900|01|01}} 124

When entering dates before AD/CE, use astronomical year numbering: 1 BC/BCE is represented by 0, 2 BC/BCE by -1, 3 BC/BCE by -2 etc. For example, the following expression returns the number of full years elapsed since the battle of Cannae, which took place on August 2, 216 BC/BCE:

{{Age|-215|8|2}} (returns "2238")

Notes

This template does not check for incorrect input:

  • {{Age|1980|7|14|1993|6|233}} returns "12" (surplus days do not count as extra months)
  • {{Age|1980|7|14|1993|88|14}} returns "13" (surplus months do not count as extra years)

Credits[edit source]

This template's code was taken from Template:Age on the English Wikipedia. This template's documentation was partially taken from Template:Age/doc.