• Home
  • Random
  • Recent changes
  • Special pages
  • Message Admin
  • Settings
  • Donate
  • About NowMusic Wiki
NowMusic Wiki
  • Talk
  • Contributions
  • Create account
  • Log in

Template:Age in days

  • Template
  • Discussion
  • Language
  • Watch
  • Edit
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:Age

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

Contents

  • 1 Usage
    • 1.1 Full dates
    • 1.2 Year, month and day
    • 1.3 Sorting
    • 1.4 Formatting
    • 1.5 Showing the unit

Usage edit

Full dates edit

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)

Examples:

{{age in days|19 Aug 2008|4 Sep 2010}} gives 746
{{age in days|27 May 2002}} gives 8,657
{{age in days||{{#time:j M Y|+ 15 months}}}}  gives 454

Year, month and day edit

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)

Examples:

{{age in days|2007|5|24|2008|4|23}}  gives 335
{{age in days|2007|5|24}} gives 6834

Sorting edit

By adding |sortable=on a sort key will be added to the output for use in sortable tables.

Formatting edit

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 and true minus signs.

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

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

Showing the unit edit

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

|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 above documentation is transcluded from Template:Age in 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://www.nowmusicwiki.org/wiki/index.php?title=Template:Age_in_days&oldid=4271"
Last edited on 20 May 2024, at 13:42

Languages

    This page is not available in other languages.

    NowMusic Wiki
    • This page was last modified on 20 May 2024, at 13:42.
    • Privacy policy
    • About NowMusic Wiki
    • Contact
    • Desktop