Cron Expression Generator

Visual generator and parser for Cron schedule expressions

Cron 表达式
* * * ? * *
每秒钟执行
常用
字段设置
秒 (0-59)
分 (0-59)
时 (0-23)
日 (1-31)
月 (1-12)
周 (0-6)
最近 5 次执行时间
12026-05-04 21:55:00
22026-05-04 21:56:00
32026-05-04 21:57:00
42026-05-04 21:58:00
52026-05-04 21:59:00

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:15
  • 0 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.