Template:Age: Difference between revisions

Jump to navigation Jump to search
No edit summary
(let's try simplifying this...)
Line 1: Line 1:
<includeonly>{{#expr:({{{4|{{CURRENTYEAR}}+377}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}</includeonly><noinclude>
<includeonly>{{#expr:({{CURRENTYEAR}}+377)-({{{1}}})-(({{CURRENTMONTH}})<({{{2}}})or({{CURRENTMONTH}})=({{{2}}})and({{CURRENTDAY}})<({{{3}}}))}}</includeonly><noinclude>
This template returns the number of full years between the current stardate and a date you specify (for instance, a character's birthday).
This template returns the number of full years between the current stardate and a date you specify (for instance, a character's birthday).
You can also specify two dates (such as a date of birth and a date of death or some other anniversary), and the template will calculate how many years passed between those dates.


===Reference===
===Reference===
Line 10: Line 8:


;Syntax<nowiki>:</nowiki>
;Syntax<nowiki>:</nowiki>
:To calculate the number of years between two dates (e.g., age at time of death):<nowiki>{{age|year1|month1|day1|year2|month2|day2}}</nowiki>
:To calculate the number of years between the current stardate and your specified date (e.g., current age):<nowiki>{{age|year|month|day}}</nowiki>
:To calculate the number of years between the current stardate and your specified date (e.g., current age):<nowiki>{{age|year1|month1|day1}}</nowiki>


; Examples<nowiki>:</nowiki>
; Examples<nowiki>:</nowiki>
Line 17: Line 14:
:: <nowiki>{{age|2353|8|18}}</nowiki>
:: <nowiki>{{age|2353|8|18}}</nowiki>
:which gives you her current age: {{age|2356|8|18}}
:which gives you her current age: {{age|2356|8|18}}
:She was on [[Deep Space 17]] when it was captured by the [[Vaadwaur]] on SD 238706.16 (i.e., June 16, 2387). How old was she then?
::<nowiki>{{age|2353|8|18|2387|6|16}}</nowiki>
:which gives you: {{age|2356|8|18|2386|7|14}}


Notice that you do NOT add leading zeros for the month or day if it is a single digit.
Notice that you do NOT add leading zeros for the month or day if it is a single digit.
: When using this template to calculate a person's age at death or a person's age on a specified date (rather than the person's current age), please substitute it into the page.
:: Example: <nowiki>{{subst:age|2353|8|18|2387|6|16}}</nowiki>
:When a template is substituted on a page, the code will be permanently replaced with the calculated value.


:When entering dates before the Common Era, use astronomical year numbering: 1 BCE is represented by 0, 2 BCE by -1, 3 BCE by -2 etc. For example, the following expression returns the number of full years between the current stardate and the Battle of Cannae, which took place on August 2, 216 BCE:
:When entering dates before the Common Era, use astronomical year numbering: 1 BCE is represented by 0, 2 BCE by -1, 3 BCE by -2 etc. For example, the following expression returns the number of full years between the current stardate and the Battle of Cannae, which took place on August 2, 216 BCE: