Template:Age in Days/doc

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:


 * ||(number of days between dates 1 and 2),
 * ||(number of days since date 1) or
 * ||(number of days until date 2)
 * }
 * ||(number of days until date 2)
 * }
 * }

Examples:


 * ||gives
 * ||gives
 * ||gives 8973 days
 * }
 * ||gives 8973 days
 * }
 * }

Year, month and day
To use, type:


 * ||(number of days between dates 1 and 2),
 * ||(number of days since date 1) or
 * ||(number of day until date 2)
 * }
 * ||(number of day until date 2)
 * }
 * }

Or with named parameters:


 * ||(number of days between dates 1 and 2),
 * ||(number of days since date 1) or
 * ||(number of day until date 2)
 * }
 * ||(number of day until date 2)
 * }
 * }

Examples:

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

Formatting
Three styles of formatting are possible.


 * raw        ||gives unformatted numbers with hyphens as minus signs (for use in further calculations).
 * commas ||gives numbers formatted with commas (using ) and true minus signs.
 * gaps       ||gives numbers formatted with thin spaces (using val) and true minus signs.
 * }
 * gaps       ||gives numbers formatted with thin spaces (using val) 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.


 * Note

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.
 * full     ||adds "day" or "days" after the number of days as appropriate.
 * }
 * full     ||adds "day" or "days" after the number of days as appropriate.
 * }

Rounding
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, for example, will give the number of days since the king of Nepal was deposed. Note that this will only work when entering full dates (e.g. will produce an error message).