Cron Expression Generator
Visual generator and parser for Cron schedule expressions
What is a Cron Expression?
A Cron expression is a string used to configure scheduled tasks, consisting of 6 or 7 fields representing second, minute, hour, day, month, weekday, and year (optional). Each field uses specific characters to define time rules, widely used in Linux systems and various task scheduling frameworks.
Syntax Guide
*所有值?不指定值(日/周)-范围,如1-5,列举,如1,3,5/间隔,如0/15每15单位L最后,如月的最后一天W工作日#第N个,如2#3第3个周二
Common Examples
0 0 12 * * ?每天中午12点0 15 10 ? * *每天上午10:150 0/5 14 * * ?每天14点每5分钟0 0 12 ? * WED每周三中午12点0 0 12 1 * ?每月1号中午12点0 15 10 15 * ?每月15号上午10:15
FAQ
What's the difference between ? and * in Cron expressions?
* means 'all possible values', while ? means 'no specific value'. Day and weekday fields are mutually exclusive. When one field has a specific value, the other must use ?.
How to express 'run every N units'?
Use the slash (/) for step values. For example: */5 * * * * ? runs every 5 minutes; 0 */2 * * * ? runs every 2 hours.
What timezone does a Cron expression use?
Cron expressions don't include timezone information. The actual execution time depends on the system timezone. It's recommended to set a consistent timezone on your servers.
What's the difference between 5-field and 6/7-field Cron expressions?
Traditional Linux Cron uses 5 fields (min hour day month weekday), while frameworks like Quartz use 6 fields (adds second) or 7 fields (adds year). This tool supports 6-7 field format.
How to express 'last weekday of each month'?
Use LW to represent the last weekday of the month. For example: 0 0 0 LW * ? runs at midnight on the last weekday of each month.