Template:Age/doc: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Caesar Schinas
No edit summary
imported>Caesar Schinas
m (Better headings)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
This template returns the number of full years elapsed from one date until another date or until today (UTC). See [[Template talk:Age]] for examples.
<!-- Do not remove this line. Replace the instructions below with the correct documentation. -->
This template returns the number of full years elapsed from one date until another date or until today (UTC).


If you use this template for calculating someone's age at death or age at a certain date (rather than their current age), please substitute it into the page, for example: <nowiki>{{subst:age|1989|7|23|2003|7|14}}</nowiki>.
=== Usage ===
To dynamically calculate the ''current'' age each time the page is loaded, use <code><nowiki>{{age|YYYY|MM|DD}}</nowiki></code>, substituting the date of birth for the letters YYYY MM DD.
 
To calculate the age at a certain date (''eg'' at death), rather than the ''current'' age, use <code><nowiki>{{age|YYYY|MM|DD|YYYY|MM|DD}}</nowiki></code>, with the date of birth as the first date and the date at which the age should be calculated (''eg'' date of death) as the second.
 
=== Examples ===
;Current age
:<code><nowiki>[[Tim Berners-Lee]] was born {{age|1955|06|08}} years ago.</nowiki></code>
:[[Tim Berners-Lee]] was born {{age|1955|06|08}} years ago.
 
;Past age
:<code><nowiki>[[Winston Churchill]] died at the age of {{age|1874|11|30|1965|01|24}}.</nowiki></code>
:[[Winston Churchill]] died at the age of {{age|1874|11|30|1965|01|24}}.

Latest revision as of 02:20, 7 May 2009

This template returns the number of full years elapsed from one date until another date or until today (UTC).

Usage

To dynamically calculate the current age each time the page is loaded, use {{age|YYYY|MM|DD}}, substituting the date of birth for the letters YYYY MM DD.

To calculate the age at a certain date (eg at death), rather than the current age, use {{age|YYYY|MM|DD|YYYY|MM|DD}}, with the date of birth as the first date and the date at which the age should be calculated (eg date of death) as the second.

Examples

Current age
[[Tim Berners-Lee]] was born {{age|1955|06|08}} years ago.
Tim Berners-Lee was born 69 years ago.
Past age
[[Winston Churchill]] died at the age of {{age|1874|11|30|1965|01|24}}.
Winston Churchill died at the age of 90.