Template:Age in years, months, weeks and days/doc: Difference between revisions

From Soyjak Wiki, The Free Soycyclopedia
Jump to navigationJump to search
No edit summary
No edit summary
 
Line 5: Line 5:
When both dates are set:
When both dates are set:


<code><nowiki>{{Age in years, months, weeks and days |month1=4 |day1=20 |year1=1889 |month2=4 |day2=30 | year2=1945 }} </nowiki></code> -> {{Age in years, months, weeks and days |month1=4 |day1=20 |year1=1889 |month2=4 |day2=30 | year2=1945 }}
<code><nowiki>{{Age in years, months, weeks and days |month1 = 4 |day1 = 20 |year1 = 1889 |month2 = 4 |day2 = 30 |year2 = 1945 }} </nowiki></code> -> {{Age in years, months, weeks and days |month1=4 |day1=20 |year1=1889 |month2=4 |day2=30 | year2=1945 }}


When there is no end date:
When there is no end date:


<code><nowiki>{{Age in years, months, weeks and days |month1=9 |day1=19 |year1=2020}} </nowiki></code> -> {{Age in years, months, weeks and days |month1=9 |day1=19 |year1=2020}}
<code><nowiki>{{Age in years, months, weeks and days |month1 = 9 |day1 = 19 |year1 = 2020 }} </nowiki></code> -> {{Age in years, months, weeks and days |month1=9 |day1=19 |year1=2020}}


When there is no start date (ie: Days until a future event)
When there is no start date (ie: Days until a future event)


<code><nowiki>{{</nowiki>Age in years, months, weeks and days |month2 = 9 |day2 = 19 |year2 = {{#ifexpr:{{CURRENTMONTH}}{{CURRENTDAY2}}>0919|{{#time:Y|+1year}}|{{CURRENTYEAR}}}} }}</code> → {{Age in years, months, weeks and days |month2=9 |day2=19 |year2={{#ifexpr:{{CURRENTMONTH}}{{CURRENTDAY2}}>0919|{{#time:Y|+1year}}|{{CURRENTYEAR}}}} }}
<code><nowiki>{{</nowiki>Age in years, months, weeks and days |month2 = 9 |day2 = 19 |year2 = {{#ifexpr:{{CURRENTMONTH}}{{CURRENTDAY2}}>0919|{{#time:Y|+1year}}|{{CURRENTYEAR}}}} }}</code> → {{Age in years, months, weeks and days |month2=9 |day2=19 |year2={{#ifexpr:{{CURRENTMONTH}}{{CURRENTDAY2}}>0919|{{#time:Y|+1year}}|{{CURRENTYEAR}}}} }}

Latest revision as of 04:09, 31 January 2023

Usage

{{Age in years, months, weeks and days |month1 = |day1 = |year1 = |month2 = |day2 = | year2 = }} 

Each value defaults to the current date.

Example

When both dates are set:

{{Age in years, months, weeks and days |month1 = 4 |day1 = 20 |year1 = 1889 |month2 = 4 |day2 = 30 |year2 = 1945 }} -> 56 years, 1 week and 3 days

When there is no end date:

{{Age in years, months, weeks and days |month1 = 9 |day1 = 19 |year1 = 2020 }} -> 3 years, 8 months and 1 day

When there is no start date (ie: Days until a future event)

{{Age in years, months, weeks and days |month2 = 9 |day2 = 19 |year2 = 2024 }} → 3 months, 4 weeks and 2 days