Template documentation (for the above template, sometimes hidden or invisible) [view] [edit] [history] [purge/refresh]

This template returns the number of days between two dates.  Dates may be input either as full dates or as year, month and day.  Omitted parameters to their current value.

See Age calculation templates wp for more information on using this kind of template.


Full dates


{{AgeD|date1|date2}} (number of days between dates 1 and 2)
{{AgeD|date1}} (number of days since date 1) or
{{AgeD| |date2}} (number of days until date 2)


{{AgeD|19 Aug 2008|4 Sep 2010}} gives 746
{{AgeD|27 May 2002}} gives 6,623
{{AgeD| |14 Oct 2021 }} gives 457

Year, month and day


{{AgeD|year1|month1|day1|year2|month2|day2}} (number of days between dates 1 and 2),
{{AgeD|year1|month1|day1}} (number of days since date 1) or
{{AgeD| | | |year2|month2|day2}} (number of day until date 2)

Or with named parameters:

{{AgeD|month1=|day1=|year1=|month2=|day2=|year2= }} (number of days between dates 1 and 2),
{{AgeD|month1=|day1=|year1= }} (number of days since date 1) or
{{AgeD|month2=|day2=|year2= }} (number of day until date 2)


{{AgeD|2007|5|24|2008|4|23}} gives 335
{{AgeD|2007|5|24}} gives 4800


Three styles of formatting are possible.

format=raw gives unformatted numbers with hyphens as minus signs[1] (for use in further calculations).
format=commas gives numbers formatted with commas (using {{formatnum:}}) and true minus signs.
format=gaps gives numbers formatted with thin spaces and true minus signs.

For reasons of retrospective compatibility, the default when inputting dates as year, month and day is raw; however when inputting dates in full it is commas.

  1. Negative days will occur if the first date is after the second.

Showing the unit

The default is not to show units.  To show the unit ("day", days" or "d") use:

show unit=abbr adds "d" after the number of days.
show unit=full adds "day" or "days" after the number of days as appropriate.


The template rounds down to the nearest number of full days.

Time zones

As noted above, date parameters left undefined default to their current value.

Note that this is the current UTC value.

The above text is transcluded from Template:AgeD/doc.
You can change it or view its history. (How does this work?)
If you're done making changes, please refresh the text. (Why?)
You can experiment in this template's Sandbox (create | Mirror ) and Testcases (create) pages.
Please add categories and interwikis to Template:AgeD/doc. (View all subpages of this page.)
Community content is available under CC-BY-SA unless otherwise noted.