Difference between revisions of "Template:CountDown"
Jump to navigation
Jump to search
(New page: <onlyinclude><includeonly>{{#vardefine:a|{{#expr:(({{ #time: U | {{{1}}}.{{{2}}}.{{{3}}} }} - {{ #time: U | {{LOCALDAY2}}.{{LOCALMONTH}}.{{LOCALYEAR}} }}) / 86400) round 0}}}}{{#ifeq:{{#e...) |
m (changed countdown dates to the future to display other results) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude><includeonly>{{#vardefine:a|{{#expr:(({{ #time: U | {{{1}}}.{{{2}}}.{{{3}}} }} - {{ #time: U | {{LOCALDAY2}}.{{LOCALMONTH}}.{{LOCALYEAR}} }}) / 86400) round 0}}}}{{#ifeq:{{#expr:({{#var:a}}>0)}}|1|{{{4|{{#var:a}}}}}|{{#ifeq:{{#expr:({{#var:a}}=0)}}|1|{{{5|{{#var:a}}}}}|{{{6|{{#var:a}}}}}}}}}</includeonly></onlyinclude> | <onlyinclude><includeonly>{{#vardefine:a|{{#expr:(({{ #time: U | {{{1}}}.{{{2}}}.{{{3}}} }} - {{ #time: U | {{LOCALDAY2}}.{{LOCALMONTH}}.{{LOCALYEAR}} }} + ({{{offset|-8}}}*3600)) / 86400) round 0}}}}{{#ifeq:{{#expr:({{#var:a}}>0)}}|1|{{{4|{{#var:a}}}}}|{{#ifeq:{{#expr:({{#var:a}}=0)}}|1|{{{5|{{#var:a}}}}}|{{{6|{{#var:a}}}}}}}}}</includeonly></onlyinclude> | ||
This template calculates a difference in days between a given date (past 01.01.1970) and the current date in | This template calculates a difference in days between a given date (past 01.01.1970) and the current date. You can set an offset relative to GMT which has the value -8 by default, in order to represent SLT.<br>Use it with <font color="black">{{NoWrap|<nowiki>{{CountDown|DD|MM|YYYY|text pre date|text at date|text post date}}</nowiki>}}</font>. Text can include <font color="black"><nowiki>{{#var:a}}</nowiki></font> to place the count. If no text is provided, only the count will be displayed. | ||
Use <pre><nowiki>day{{#ifeq:{{#var:a}}|1||s}}</nowiki></pre> to distinguish between "day" and "days", depending on the count. | |||
Example: | Example: | ||
Line 8: | Line 11: | ||
!Output | !Output | ||
|- | |- | ||
|<nowiki>{{CountDown|27|01| | |<nowiki>{{CountDown|27|01|2012|OMG, only {{#var:a}} days until my rezday!!|POARTY!!!|Oh... rezzday is over... what a night.}}</nowiki> | ||
|{{CountDown|27|01| | |{{CountDown|27|01|2012|OMG, only {{#var:a}} days until my rezday!!|POARTY!!!|Oh... rezzday is over... what a night.}} | ||
|- | |||
|<nowiki>{{CountDown|27|01|2008|OMG, only {{#var:a}} days until my rezday!!|POARTY!!!|Oh... rezzday is over... what a night.}}</nowiki> | |||
|{{CountDown|27|01|2008|OMG, only {{#var:a}} days until my rezday!!|POARTY!!!|Oh... rezzday is over... what a night.}} | |||
|- | |- | ||
|<nowiki>{{CountDown|27|01| | |<nowiki>{{CountDown|27|01|2012}}</nowiki> | ||
|{{CountDown|27|01| | |{{CountDown|27|01|2012}} | ||
|- | |- | ||
|<nowiki>{{CountDown|27|01| | |<nowiki>{{CountDown|27|01|2012|offset=0}}</nowiki> | ||
|{{CountDown|27|01| | |{{CountDown|27|01|2012|offset=0}} | ||
|} | |} |
Latest revision as of 05:00, 9 September 2010
This template calculates a difference in days between a given date (past 01.01.1970) and the current date. You can set an offset relative to GMT which has the value -8 by default, in order to represent SLT.
Use it with {{CountDown|DD|MM|YYYY|text pre date|text at date|text post date}}. Text can include {{#var:a}} to place the count. If no text is provided, only the count will be displayed.
Use
day{{#ifeq:{{#var:a}}|1||s}}
to distinguish between "day" and "days", depending on the count.
Example:
Input | Output |
---|---|
{{CountDown|27|01|2012|OMG, only {{#var:a}} days until my rezday!!|POARTY!!!|Oh... rezzday is over... what a night.}} | Oh... rezzday is over... what a night. |
{{CountDown|27|01|2008|OMG, only {{#var:a}} days until my rezday!!|POARTY!!!|Oh... rezzday is over... what a night.}} | Oh... rezzday is over... what a night. |
{{CountDown|27|01|2012}} | |
{{CountDown|27|01|2012|offset=0}} |