|
|
| 第1行: |
第1行: |
| <includeonly>{{#ifeq:{{#expr: {{#expr: {{#time:U}} + 28800}} < {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}}}}|1|{{{a|距離}}}{{{event|這次事件}}}{{{b|尚餘}}}{{#ifeq:{{#expr: {{#expr: {{#time:U}} + 28800}} < {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - 86399}}|1|'''<span style="color: {{{color|red}}}">{{#expr:( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}}) / 86400 ) -0.5) round 0}}</span>'''天|}}{{#ifeq:{{#expr: {{#expr: {{#time:U}} + 28800}} > {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - 3600}}|1|{{#ifeq: {{#expr: ( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}} ) / 60 ) - 0.5 ) round 0 }}|0|'''<span style="color: {{{color|red}}}">{{#expr: {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}}}}</span>'''秒|'''<span style="color: {{{color|red}}}">{{#expr: ( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}} ) / 60 ) - 0.5 ) round 0 }}</span>'''分鐘}}|'''<span style="color: {{{color|red}}}">{{#expr:{{#expr: ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}} ) / 3600 - ( ( ( ( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}}) / 86400 ) - 0.5 ) round 0 )* 24 ) -0.5 ) round 0}} - 1}}</span>'''小時}}|{{#if:{{{duration|}}}|{{#ifeq:{{#expr: ({{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} + {{{duration}}}) > {{#expr: {{#time:U}} + 28800}}}}|1|{{{eventstart|{{{event|這次事件}}}已經開始}}}|{{{eventend|{{{event|這次事件}}}已完結}}}}}|{{{eventend|{{{event|這次事件}}}已完結}}}}}}}{{#if:{{yesno|{{{nopurge|}}}}}||<small>({{purge|更新}})</small>}}</includeonly><noinclude>{{Documentation}}</noinclude> | | <includeonly><span class="countdownNode" data-target="{{{1|}}}{{{time|}}}" data-before="{{{before|}}}" data-after="{{{after|}}}"> - </span>{{#Widget:Countdown}}</includeonly><noinclude>{{doc}}</noinclude> |
本模板用以显示特定时间与现在的差距
参数
- time
- 匿名参数 1
- (只可使用其中一个)指定目标时间,可以参照下方示例中的说明填写。
- before
- 指定目标时间比现在早时的格式,默认为
$1前($1代指目标时间差值,下同,见#示例)。
- after
- 指定目标时间比现在晚时的格式,默认为
还剩$1。
示例
- 代码
迪亚马特彗星分裂出的一部分{{Countdown|time=2013-10-04 20:42+09:00|before=在$1之前|after=将在$1后}}坠落于糸守町,摧毁了该城镇。<small>——可以在时刻后指定时区,若写Z则代表UTC时间,即0时区</small>
{{Countdown|2027-06-25T18+09}},一行瑠璃就接受了坚书直实的表白。<small>——空格和T都可以分隔日期与时间;时间是整点时,可以省略后续部分</small>
{{Countdown|time={{LOCALYEAR}}|before=你醒啦,新年已经结束啦}}<small>——甚至可以只填年份,就会默认为该年1月1日零时整。这里使用系统变量魔术字提供了今年的年份</small>
{{Countdown|time={{#expr:{{LOCALYEAR}}+1}}|after=今年还有$1}},尚待{{ruby|体验|浪费}}<small>——这里是使用解析器函数计算出了明年的年份</small>
- 结果
迪亚马特彗星分裂出的一部分
- 坠落于糸守町,摧毁了该城镇。
——可以在时刻后指定时区,若写Z则代表UTC时间,即0时区
- ,一行瑠璃就接受了坚书直实的表白。
——空格和T都可以分隔日期与时间;时间是整点时,可以省略后续部分
- ——甚至可以只填年份,就会默认为该年1月1日零时整。这里使用系统变量魔术字提供了今年的年份
- ,尚待
体验——这里是使用解析器函数计算出了明年的年份