Template:Countdown
本模板含有複雜而精密的扩展语法。 編輯本模板前,建議您先熟悉解析器函數与本模板的设计思路、运作原理等。若您的編輯引發了意外的問題,請儘快撤銷編輯,因為本模板可能被大量頁面使用。 您所作的编辑可先在本模板的沙盒或您的个人页面中进行測試。 |
這個是一個倒數模板。此模板使用了時間序號來製作,並能準確至一秒。
準確性
此模板雖然最多是以每分鐘倒數,但準確性為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。因此,請使用前留意此事項。
上述文档嵌入自Template:Countdown/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (编辑 | 差异)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模板的子页面。 |