> For the complete documentation index, see [llms.txt](https://gyx8899.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyx8899.gitbook.io/blog/docs/corn.md).

# Corn 表达式

## 在线工具

* [在线 CRON](https://cron.qqe2.com/)

## 格式示例

| 秒    | 分钟   | 小时   | 日    | 月              | 周             | 年         |
| ---- | ---- | ---- | ---- | -------------- | ------------- | --------- |
| 0-59 | 0-59 | 0-23 | 1-31 | 1-12 或 JAN-DEC | 0-7 或 SUN-SAT | 1970–2099 |

* 7 列，以空格为间隔，最后年可省略（当不指定年的时候）
* 周：0-7，其中 0 和 7 都代表周日（Linux 和 Spring）
* 周：1-7，其中 1为周日（Quartz）
* 周值：MON, TUE, WED, THU, FRI, SAT, SUN
* 月值：1-31
* 月值：JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
* 年：非必填

## 特殊字符

* 逗号，枚举值，分割列表，如 MON,FRI,SUN
* 连字符，指定范围，如 2000-2021，表示2000到2021期间的每一年
* 星号，所有可能的值，Month 中表示每个月，Hours 中表示每个小时
* 反斜杠，每N秒/分钟/小时/日/月/周/年，如 Minutes 中，0/15 表示0分钟开始，每15分钟执行一次
* 问号，没有具体值，避免冲突时设置
