• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.215
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Age in years and days

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:Age

This template returns the number of full years and surplus days between two specified dates. If only one date is entered, the template returns the number of full years and surplus days between the specified date and today's date.

This template does not generate a sort key. In a sortable table, use {{ayd}} which redirects to {{age in years and days nts}}.

Usage

Each date can be entered in a single parameter, or each date can be entered as three parameters: year, month, day.

  • {{age in years and days|15 May 2010}} → 15 years, 329 days
  • {{age in years and days|12 Aug 2003|24 Sep 2011}} → 8 years, 43 days
  • {{age in years and days|1989|7|23}} → 36 years, 260 days
  • {{age in years and days|1989|7|23|2003|7|24}} → 14 years, 1 day
  • {{age in years and days|2007-03-02|2008-03-02}} → 1 year, 0 days

An error is shown if an entered date is not valid (1900 was not a leap year).

  • {{age in years and days|31 January 1892|29 February 1900}} → Error: Second date should be year, month, day

Options

The default is to separate years and days with a comma. The separator is "and" if |sep=and is used.

The default calculates an age—the day of the second date is not included in the calculation. A duration including the second date is calculated if |duration=on is used.

  • {{age in years and days|1 Jan 2011|31 Dec 2012}} → 1 year, 365 days
  • {{age in years and days|1 Jan 2011|31 Dec 2012|sep=and}} → 1 year and 365 days
  • {{age in years and days|1 Jan 2011|31 Dec 2012|duration=on}} → 2 years, 0 days

TemplateData

Returns the number of full years and surplus days between two specified dates (or, if only one date is entered, between the specified date and today's date)

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Earlier date1

The earlier date being compared

Daterequired
Later date2

The later date being compared

Default
Today's date
Datesuggested
Separatorsep

Defines a custom separator between the years and days

Suggested values
and
Default
,
Stringoptional
Duration?duration

Set to "on" to include the second date in the calculation; will return a result one higher than if left off

Booleanoptional
  • v
  • t
  • e
Birth, death and age templates
birth, death, age
Combined BDA template Description / use 
{{BirthDeathAge}}Combines functions of {{Birth date}}, {{birth-date}}, {{birth date and age}}, {{birth year and age}}, {{death date}}, {{death-date}}, {{death date and age}}, and {{death year and age}}.
Birth templates Description / use 
{{Birth date}}To display a birth date and related hidden metadata.
{{Birth-date}}
{{Birth date and age}}{{Birth date}} with suffix '(age N)'.
{{Birth date and age2}}{{Birth date and age}} plus age as of a specified date.
{{Birth-date and age}}As {{Birth date and age}}, but accepts dates in text form ('15 June 1950', 'June 15, 1950', 'June 1950', etc).
{{Birth year and age}}Year of birth and approximate age.
{{Birth based on age as of date}}To display approximate birth year and current age given a particular date (e.g. when a dated reference mentions the age of a person), only works for living people.
{{Birth based on age at death}}To display approximate birth year based on age at death, or on age at a specific date if death date isn't known.
Death templates Description / use 
{{Death date}}To display a death date and related hidden metadata.
{{Death-date}}
{{Death date and age}}{{Death date}} with suffix '(aged N)'; also called with {{event date and age}}.
{{Death-date and age}}As {{Death date and age}}, but accepts dates in text form ('15 June 1950', 'June 15, 1950', 'June 1950', etc).
{{Death date and given age}}To display a death date and specified age.
{{Death year and age}}To display a year of, and approximate age at death.
age only
Conventional age templates Description / use 
{{Age in years, months, weeks and days}}Number of complete years, months, weeks and days between two dates.
{{Age in years, months and days}}Number of complete years, months and days between two dates.
{{Age in years and months}}Number of complete years and remaining months between two dates.
{{Age in years and days}}Number of complete years and remaining days between two dates.
{{Age in years and days nts}}{{Age in years and days}} with output formatted for use in number sortable tables.
{{Age in decimal years}}Number of years between two dates, rounded to the specified number of decimal places.
{{Age in years}}Number of years between two dates.
{{Age in years nts}}{{Age in years}} with output formatted for use in number sortable tables.
{{Age in months}}Number of months between two dates.
{{Age in weeks and days}}Number of weeks and days between two dates.
{{Age in weeks}}Number of weeks between two dates.
{{Age in days}}Age in days between two dates.
{{Age in days nts}}{{Age in days}} with output formatted for use in number sortable tables.
Reverse-determined age template Description / use 
{{Age}}Age based on number of complete years between two dates.
{{Age nts}}{{Age}} with output formatted for use in number sortable tables.
{{Age as of date}}Current age (in years) from a known age at a specified date.
{{Age for infant}}Current age for infant: months and days up to one year, years and months up to three years, and years beyond age 3.
start / end dates
Date-focused templates Description / use 
{{Start date}} / {{End date}}
{{Start-date}} / {{End-date}}
{{Start date and age}}
{{End date and age}}
miscellaneous
Template Description / use 
{{OldStyleDate}}Dates in Julian calendar.
{{OldStyleDateDY}}As {{OldStyleDate}} but used when Julian / Gregorian dates fall in different years.
{{OldStyleDateNY}}As {{OldStyleDate}} but without the year.
{{Unidentified for}}
{{Missing for}}
  • About age calculation templates
  • Date mathematics templates
The above documentation is transcluded from Template:Age in years and days/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Age_in_years_and_days&oldid=4862"
Categories:
  • Lua-based templates
  • Date mathematics templates
Last edited on 21 October 2021, at 21:53

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 21 October 2021, at 21:53.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop