Home › Code and dev › Cron Expression Generator
🔧

Cron Expression Generator

Build cron expressions by picking values for each field, with plain-language translation and a preview of the next 5 run times, plus handy presets

常用模板(点选后可继续微调)
逐域配置
Cron 表达式
—
—
未来 5 次执行时间(本地时区)
次序 触发时间 距今
域取值速查
域 取值范围 允许的特殊字符
秒(6 域)0-59* , - /
分0-59* , - /
时0-23* , - /
日1-31* , - / (6 域还可用 ? L W)
月1-12* , - /
周0-7(0 和 7 都是周日)* , - / (6 域还可用 ? L #)

About this tool

Cron expressions are memorization traps: five fields or six, can day-of-month and day-of-week coexist, how do you write the last Friday of a month? This page spreads the six fields — second, minute, hour, day, month, weekday — into pick controls, generates the expression as you click, and translates it into plain language.

  • Field-by-field picking: wildcard *, exact values, ranges, steps (*/5) and lists in every field
  • Live plain-language translation: "at minute 30 of every hour", "at 09:00 from Monday through Friday" — you see what the expression means as you build it
  • Next 5 runs preview: computed in your browser's local time zone, so mistakes show up immediately
  • 5-field / 6-field switch: defaults to the Linux crontab 5-field format; one click switches to 6 fields with seconds for Quartz, Spring and Java
  • Common presets: every minute, daily at 9, Mondays at 9, first day of the month, every 2 hours on weekdays — fill in then fine-tune

Use cases

  • Writing Linux crontab jobs and backup scripts
  • The cron parameter of Spring / Quartz jobs
  • Scheduled triggers in Jenkins and GitHub Actions
  • Debugging why a scheduled job did not run when expected

Cron syntax cheat sheet

  • Field order: 5 fields are minute hour day month weekday; 6 fields prepend seconds (the Quartz / Spring convention)
  • Special characters: * any value; ? no value (the mutually exclusive day/weekday placeholder in 6-field syntax); - range; , list; / step; L last day; W nearest weekday (Quartz extensions)
  • Day and weekday both restricted: standard Vixie cron triggers when EITHER matches; restricting only one field and leaving the other as * is the safest form
  • Time zone: crontab runs on system time — sync clocks first when the server and your local time zone differ