Actions

Template

Difference between revisions of "Age"

From NEC Retro

(Created page with "<includeonly>{{#vardefine:date2|{{#if:{{{2|}}}|{{{2|}}}|{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}}}}}{{#vardefine:date1y|{{#sub:{{#explode:{{{1|}}}|-|0}}|0|4}}}}{{#varde...")
 
m (Text replacement - "Category:NEC Retro templates" to "Category:Templates")
 
Line 36: Line 36:
 
* <nowiki>{{age|1991-06-23|1999-09-09}}</nowiki> = {{age|1991-06-23|1999-09-09}}
 
* <nowiki>{{age|1991-06-23|1999-09-09}}</nowiki> = {{age|1991-06-23|1999-09-09}}
  
[[Category:NEC Retro templates]]</noinclude>
+
[[Category:Templates]]</noinclude>

Latest revision as of 13:35, 1 January 2022

Convert a date in the format YYYY-MM-DD to an age in years (based on the current date).

Usage

  • {{age|1991-06-23}} = 33
  • {{age|1991}} = 32-33
  • {{age|1999-xx-xx}} = 24-25
  • {{age|199x}} = 24-34
  • {{age|199x|2000}} = 0-10
  • {{age|199x|lowonly=yes}} = 24
  • {{age|199x|highonly=yes}} = 34

Optional parameter

Add a second date to calculate the age on that date.

  • {{age|1991-06-23|1999-09-09}} = 8