算清 cron 表示式到底什麼時候執行
把五段式 cron 表示式換算成接下來數次執行時間,依你自己的時區,並正確處理「日」與「週」欄位之間的 OR 語意。
不需要檔案。請選擇你的排程器實際使用的時區位移。
在本分頁內執行,不上傳任何內容。
結果
免費方案:不需要檔案,每次 1 個輸入,每天 10 次。這件工具單件買斷 $24,一次付款。比較價格。
授權:免費方案。
這頁與別處不同之處
多數 cron 問題不是語法寫錯,而是「日」和「週」同時被限定時究竟算 AND 還是 OR——規格答案是 OR,但不少實作悄悄依 AND 計算。這個頁面依規格做屏障式跳進求解,逐次給出真實觸發時間,並把時區位移當成參數而不是靠猜。
依規格實作「日/週」的 OR 語意,並直接給出該時區下的具體時間點。
範例輸入與輸出
| 環節 | 情形 | 體積 | 說明 |
|---|---|---|---|
| 輸入 | 一條 cron 表示式 | 19 B | 0 9 * * 1-5 — weekday mornings, with no timezone stated anywhere |
| 輸出 | 接下來十次執行的文字 | 470 B | dates and weekday names resolved against a UTC+8 offset, about 47 bytes per line |
這裡寫的是本頁建置時對照的示範數字,不是對每個檔案的承諾。
你可以自己核對什麼
| 承諾 | 測試結果 |
|---|---|
| 列出的每次執行都落在表示式要求的分鐘上。 | 「*/15 9-17 * * 1-5」在 UTC+08:00 下只出現 :00、:15、:30、:45,時間在 09:00 到 17:45 之間,且只列工作日。 |
| 時區位移被真的套用,而不是忽略。 | 輸出把每個時間戳標為 UTC+08:00 並相應平移小時,09:00 是本地視窗起點,不是 01:00。 |
常見問題
以下問答目前仍為英文原文。
Why does a schedule matching both the 13th and Fridays fire on days that only satisfy one?
Because that is the classic cron behaviour: when both day fields are restricted, either may match. Many people expect an AND, which is why "the job ran on a day it should not have" is such a common incident. This page implements the OR, and says so.
Which timezone are the results in?
Whichever offset you enter, starting from the browser local time as the default. Servers running cron usually use their own local time, which is the single most common source of a job that never fires when expected.
What syntax is supported?
Stars, numbers, lists, ranges and steps, in the standard five fields: minute, hour, day of month, month, day of week. Both 0 and 7 mean Sunday.
What about seconds, or @daily style shortcuts?
Not supported, deliberately. Six-field cron with seconds exists in some schedulers and means something different from five-field cron; guessing which one you meant is worse than refusing.
What happens if the expression can never fire?
The page says so. February 31st never arrives, and a tool that silently returns nothing would leave you debugging a job that was never schedulable.
價格
這件工具一次性 $24,只要工具還在就一直可用。一次付款,不是訂閱。授權存在目前瀏覽器裡,憑交易編號可在別處還原。
免費方案:每天 10 次。買斷:不限每天次數。其餘不變——這頁每次只處理一個輸入。