Template:Age in days/doc

From xP// Wiki
Revision as of 21:36, 1 March 2020 by Xenoyia (talk | contribs) (Created page with "{{Documentation subpage}} <!-- Place categories where indicated at the bottom of this page and interwikis at Wikidata --> {{High-use|2348}} {{Lua|Module:Age}} {{Template short...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Documentation subpage Template:High-use Template:Lua Template:Template shortcuts

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.


Full dates

To use, type:

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


{{age in days|19 Aug 2008|4 Sep 2010}} gives Template:Age in days
{{age in days|27 May 2002}} gives Template:Age in days
{{age in days||{{#time:j M Y|+ 15 months}}}}  gives Template:Age in days

Year, month and day

To use, type:

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

Or with named parameters:

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


{{age in days|2007|5|24|2008|4|23}}  gives Template:Age in days
{{age in days|2007|5|24}} gives Template:Age in days


By adding Template:Para a sort key will be added to the output for use in sortable tables. The sort key is produced by Template:Tl and is based on the SI unit of time (the second).


Three styles of formatting are possible.

Template:Para gives unformatted numbers with hyphens as minus signs<ref>Negative days will occur if the first date is after the second.</ref> (for use in further calculations).
Template:Para  gives numbers formatted with commas (using {{formatnum:}}) and true minus signs.
Template:Para gives numbers formatted with thin spaces (using Template:Tl) and true minus signs.

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



Showing the unit

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

Template:Para  adds "d" after the number of days.
Template:Para 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. Instead of leaving the parameter blank, however, an offset may be added, Template:Nowrap will give the number of days since the king of Nepal was deposed.Template:Dubious Note that this will only work when entering full dates Template:Nowrap will produce an error message).

See also


Template:Birth, death and age templates