Template:Age in years and days/doc

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.

A hidden sort key is included so values produced by this template will work properly in sortable tables. The sort key is calculated from the number of days between the given dates, and is compatible with number table sorting. However, use of the sort key is deprecated as it will be removed from this template. If a sort key is wanted, 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).


 * → 22 years, 220 days
 * → 35 years, 13 days
 * → 14 years, 4 days
 * → 1 year, 1 day
 * → 1 year, 1 day

An error is shown if an entered date is not valid (1900 was not a leap year).
 * → 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 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 on is used.


 * → 23 years, 182 days
 * → 23 years, 182 days
 * → 23 years, 182 days