Difference between revisions of "Template:Age in days"

From Rigged Wiki
Jump to navigation Jump to search
(Created page with "<includeonly>{{#expr: + {{Gregorian serial date |month = {{{month2|{{CURRENTMONTH}} }}} |day = {{{day2|{{CURRENTDAY}} }}} |year = {{{year2|{{CURRENTYEAR}} }}} }} - {{Gregorian serial date |month = {{{month1|{{CURRENTMONTH}} }}} |day = {{{day1|{{CURRENTDAY}} }}} |year = {{{year1|{{CURRENTYEAR}} }}} }} }}</i...")
 
m (Reverted edits by F4r (talk) to last revision by Ryperiour2)
Tag: Rollback
 
(8 intermediate revisions by 2 users not shown)
Line 12: Line 12:
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
</noinclude><noinclude>
</noinclude><noinclude>
{{TemplateDoc|pages=Any|purpose=Calculates the number of days between two dates|cat=Date mathematics templates}}
{{Parms|
{{Parms|
{{Parm|month1|month of start date|no (see note)|defaults to current month}}
{{Parm|month1|month of start date|no (see note)|defaults to current month}}
Line 23: Line 22:
Note:  It is pointless omitting all parameters, as the calculation will then return zero (the number of days between today and today).
Note:  It is pointless omitting all parameters, as the calculation will then return zero (the number of days between today and today).


If the second set of parameters is not included it will automatically calculate the days between a given date and today. To use type: '''<nowiki>{{Age in days|month1= |day1= |year1= |month2= |day2= | year2=}}</nowiki>'''
If the second set of parameters is not included it will automatically calculate the days between a given date and today. To use type: '''<nowiki>{{Age in days|month1= |day1= |year1= |month2= |day2= | year2=}}</nowiki>''' <br>
The end date will default to the current date if the second set of parameters is not used. '''<nowiki>{{Age in days|month1= |day1= |year1= }}</nowiki>''' <br>
Using only the 2nd set of parameters will result in a negative number as the output. '''<nowiki>{{Age in days|month2= |day2= |year2= }}</nowiki>''' <br>
Setting the parameters to 0 may result in an error <br>
See also [[Template:Age in days addrem]] for +/- to values
== Examples ==
Zero parameters
<pre>{{Age in days}}</pre>  → {{Age in days}} <br>
 
First set of parameters only (Start date January 1st, 2020)
<pre>{{Age in days|month1=1|day1=1|year1=2020}}</pre>  → {{Age in days|month1=1|day1=1|year1=2020}} <br>
 
Second set of parameters only (End date January 1st, 2020)
<pre>{{Age in days|month2=1|day2=1|year2=2020}}</pre>  → {{Age in days|month2=1|day2=1|year2=2020}} <br>
 
Both sets of parameters (January 1st, 2020 to January 1st, 2022)
<pre>{{Age in days|month1=1|day1=1|year1=2020|month2=1|day2=1|year2=2022}}</pre> → {{Age in days|month1=1|day1=1|year1=2020|month2=1|day2=1|year2=2022}} <br>
 
</noinclude>
</noinclude>

Latest revision as of 03:32, 19 March 2025


Template Parameters
(See using templates).
Name Purpose Required? Comment
month1 month of start date no (see note) defaults to current month
day1 day of month of start date no (see note) defaults to today's date
year1 year of start date no (see note) defaults to current year
month2 month of end date no (see note) defaults to current month
day2 day of month of end date no (see note) defaults to today's date
year2 year of end date no (see note) defaults to current year

Note: It is pointless omitting all parameters, as the calculation will then return zero (the number of days between today and today).

If the second set of parameters is not included it will automatically calculate the days between a given date and today. To use type: {{Age in days|month1= |day1= |year1= |month2= |day2= | year2=}}
The end date will default to the current date if the second set of parameters is not used. {{Age in days|month1= |day1= |year1= }}
Using only the 2nd set of parameters will result in a negative number as the output. {{Age in days|month2= |day2= |year2= }}
Setting the parameters to 0 may result in an error
See also Template:Age in days addrem for +/- to values

Examples

Zero parameters

{{Age in days}}

→ 0

First set of parameters only (Start date January 1st, 2020)

{{Age in days|month1=1|day1=1|year1=2020}}

→ 1934

Second set of parameters only (End date January 1st, 2020)

{{Age in days|month2=1|day2=1|year2=2020}}

→ -1934

Both sets of parameters (January 1st, 2020 to January 1st, 2022)

{{Age in days|month1=1|day1=1|year1=2020|month2=1|day2=1|year2=2022}}

→ 731