Cron 解析器

解析Cron表达式,计算下次执行时间并转换为易读格式。

Cron表达式
分钟
小时
日(月)
日(周)
可读描述
每天00:00(午夜)
接下来5次执行
Cron 解析器
Cron语法参考
格式 分钟 小时 日(月) 月 日(周)
* 任意值
, 值列表分隔符(例如:1,3,5)
- 值范围(例如:1-5)
/ 步进值(例如:*/5 = 每5)
分钟: 0-59
小时: 0-23
日: 1-31
月: 1-12
星期: 0-6 (日-六)
Cron 表达式

A cron expression is a string consisting of five or six fields that define a schedule for running automated tasks. Originally from Unix cron daemon, this syntax is now used in many scheduling systems. Each field represents a time unit: minute, hour, day of month, month, day of week, and optionally year.

Cron Field Format

Standard cron has 5 fields: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-6, Sunday=0). Special characters include: * (any), , (list), - (range), / (step). Extended formats may include seconds and year fields.

Cron 解析器
  • Scheduling backup jobs
  • Running periodic data synchronization
  • Sending scheduled emails or notifications
  • Clearing temporary files and caches
  • Generating periodic reports
Cron 解析器
输入: 0 0 * * *
输出: 每 5 分钟
输入: */15 * * * *
输出: 每分钟
输入: 0 9 * * 1-5
输出: 每天
输入: 0 0 1 * *
输出: First day of every month at midnight
Frequently Asked Questions

What timezone does cron use?

Traditional cron uses the system timezone. Modern schedulers like Kubernetes CronJobs let you specify the timezone. Always verify which timezone your cron system uses.

How do I run a job every second?

Standard 5-field cron doesn't support seconds (minimum is every minute). Some systems like Quartz support 6-field cron with seconds. Alternatives include using sleep loops or task schedulers designed for sub-minute intervals.