Template:Countdown

这是本页的一个历史版本,由Sap00acm留言 | 贡献2009年2月8日 (日) 08:58编辑。这可能和当前版本存在着巨大的差异。

文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

這個是一個倒數模板。此模板使用了時間序號來製作,並能準確至一秒。

準確性

此模板雖然最多是以每分鐘倒數,但準確性為1秒。

  • 在該時間1天前:倒數天數小時數
  • 在該時間1天內:只倒數小時數
  • 在該時間1小時內:只倒數分鐘數
  • 在該時間1分鐘內:只倒數秒數

(詳細見下)

用法

一般倒數

這類倒數適用於日子的倒數,並沒有「過渡期」。

{{countdown
 | year        = 
 | month       =
 | day         =
 | hour        =
 | minute      =
 | second      =
 | event       = 
 | eventend    = 
}}
參數 說明 應填寫例子
year 年份 2023
month 月份 4
day 日子 22
hour 00
minute 分鐘 00
second 秒數 00
event 事件 2023年4月22日
eventend 事件過去後的文字 2023年4月22日已到達
{{countdown
 | year        = 2023
 | month       = 4
 | day         = 22
 | hour        = 00
 | minute      = 00
 | second      = 00
 | event       = 2023年4月22日
 | eventend    = 2023年4月22日已到達
}}

效果為:{{#ifeq:{{#expr: 1726390395 < {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2023-4-22 00:00:{Template:Second|1|距離2023年4月22日尚餘{{#ifeq:{{#expr: 1726390395 < {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2023-4-22 00:00:{Template:Second - 86399|1|{{#expr:( ( ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|错误:时间格式不正确{{#ifeq:{{#expr: 1726390395 > {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2023-4-22 00:00:{Template:Second - 3600|1|{{#ifeq: {{#expr: ( ( ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2023-4-22 00:00:{Template:Second - 1726390395 ) / 60 ) - 0.5 ) round 0|0|{{#expr: {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2023-4-22 00:00:{Template:Second - 1726390395秒|{{#expr: ( ( ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|错误:时间格式不正确|{{#expr:{{#expr: ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2023-4-22 00:00:{{{second - 1726390395 ) / 3600 - ( ( ( ( ( ( 错误:时间格式不正确小時|{{#ifexist:|{{#ifeq:表达式错误:预期外的<运算符。

詳細倒數

這類倒數適用於事件倒數,並有「過渡期」的事件,例如日食倒數。

{{countdown
 | year        = 
 | month       =
 | day         =
 | hour        =
 | minute      =
 | second      =
 | event       = 
 | duration    =  
 | eventstart  = 
 | eventend    = 
}}
參數 說明 應填寫例子
year 年份 2022
month 月份 1
day 日子 1
hour 14
minute 分鐘 22
second 秒數 28
event 事件 2022年1月1日日食
duration 事件長期(秒) 45000
eventstart 事件開始後 2022年1月1日日食已經開始
eventend 事件過去後的文字 2022年1月1日日食已經完結
  • 註:2022年1月1日日食並非屬實。

例子

{{countdown
 | year        = 2022
 | month       = 1
 | day         = 1
 | hour        = 14
 | minute      = 22
 | second      = 28
 | event       = 2022年1月1日日食
 | duration    = 45000
 | eventstart  = 2022年1月1日日食已經開始
 | eventend    = 2022年1月1日日食已經完結
}}

效果為:{{#ifeq:{{#expr: 1726390395 < {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2022-1-1 14:22:{Template:Second|1|距離2022年1月1日日食尚餘{{#ifeq:{{#expr: 1726390395 < {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2022-1-1 14:22:{Template:Second - 86399|1|{{#expr:( ( ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|错误:时间格式不正确{{#ifeq:{{#expr: 1726390395 > {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2022-1-1 14:22:{Template:Second - 3600|1|{{#ifeq: {{#expr: ( ( ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2022-1-1 14:22:{Template:Second - 1726390395 ) / 60 ) - 0.5 ) round 0|0|{{#expr: {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2022-1-1 14:22:{Template:Second - 1726390395秒|{{#expr: ( ( ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|错误:时间格式不正确|{{#expr:{{#expr: ( {{#ifexist:{{{timecode}}}|{{{timecode}}}|{{#time:U|2022-1-1 14:22:{{{second - 1726390395 ) / 3600 - ( ( ( ( ( ( 错误:时间格式不正确小時|{{#ifexist:45000|{{#ifeq:表达式错误:预期外的<运算符。

注意事項

請注意!這個模板倒數是使用國際標準時間UTC+0。因此,請使用前留意此事項。