Template:Countdown: Difference between revisions

Template page
(It works!)
(note about two digits)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>{{#expr:{{#time:z|{{{1}}}{{{2}}}{{{3}}}}}-{{#time:z|{{{4|{{CURRENTYEAR}}}}}{{{5|{{CURRENTMONTH}}}}}{{{6|{{CURRENTDAY2}}}}}}}}}</includeonly><noinclude>
{{#expr:{{#time:z|{{{1}}}{{{2}}}{{{3}}}}}-{{#time:z|{{{4|{{CURRENTYEAR}}}}}{{{5|{{CURRENTMONTH}}}}}{{{6|{{CURRENTDAY2}}}}}}}}}
</includeonly><noinclude>
== Documentation ==
== Documentation ==
This template displays the amount of days between two different dates.
This template displays the amount of days between two different dates.
Line 11: Line 9:
:{{tlp|{{PAGENAME}}|''year1''|''month1''|''day1''}}
:{{tlp|{{PAGENAME}}|''year1''|''month1''|''day1''}}
::Displays the difference between the given date and today.
::Displays the difference between the given date and today.
:::'''Note:''' day and month parameters have to be specified in two digits, i.e. 8 becomes 08.


=== Examples ===
=== Examples ===
Line 17: Line 16:
:{{tlp|{{PAGENAME}}|2007|11|24|2007|07|31}}
:{{tlp|{{PAGENAME}}|2007|11|24|2007|07|31}}
::{{{{PAGENAME}}|2007|11|24|2007|07|31}}
::{{{{PAGENAME}}|2007|11|24|2007|07|31}}
=== Known issues ===
* This template does not work across year boundaries, i.e. <code><nowiki>{{Countdown|2008|01|08|2007|12|31}}</nowiki></code> returns {{Countdown|2008|01|08|2007|12|31}}


[[Category:Mathematical templates|{{PAGENAME}}]]
[[Category:Mathematical templates|{{PAGENAME}}]]
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
</noinclude>
</noinclude>

Latest revision as of 19:28, 17 August 2007

Documentation

This template displays the amount of days between two different dates.

Note: This template does not work across years.

Syntax

{{Countdown|year1|month1|day1|year2|month2|day2}}
Displays the difference between the two dates given.
{{Countdown|year1|month1|day1}}
Displays the difference between the given date and today.
Note: day and month parameters have to be specified in two digits, i.e. 8 becomes 08.

Examples

{{Countdown|2007|11|24}}
221
{{Countdown|2007|11|24|2007|07|31}}
116

Known issues

  • This template does not work across year boundaries, i.e. {{Countdown|2008|01|08|2007|12|31}} returns -357