Quartz Cron
Java's Quartz Scheduler — 6 or 7 fields, seconds resolution, `L`/`W`/`#` tokens, and 1-indexed day-of-week.
Overview
Quartz is the most expressive cron dialect in common use. It adds a seconds field at the start, an optional year field at the end, and the `L`, `W`, `#`, and `?` tokens for advanced date selection.
Quartz is used by Java's Quartz Scheduler, Spring Scheduler (via the same parser), Apache Airflow's `cron_descriptor`, and many enterprise schedulers.
Field Structure
Field Order6 or 7 fields: second minute hour day-of-month month day-of-week [year]
Day-of-Week1=Sunday, 2=Monday, …, 7=Saturday.
Special Characters
| Token | Meaning |
|---|---|
| * | Any value. |
| , | List. |
| - | Range. |
| / | Step. |
| ? | “No specific value” — required in either DOM or DOW, but not both. |
| L | Last (e.g. `L` = last day of month; `6L` = last Friday of month). |
| W | Nearest weekday (`15W` = weekday closest to the 15th). |
| LW | Last weekday of month. |
| # | Nth weekday of month (e.g. `6#3` = third Friday). |
Aliases
- Not supported — no `@hourly` etc.
Comparison vs. Unix Cron
| Feature | Quartz Cron | Unix Cron |
|---|---|---|
| Field count | 6 or 7 (with year) | 5 |
| Seconds field | Yes (first field) | No |
| Step syntax | Yes | Limited |
| Named months/days | Yes | No |
| Aliases | No | No |
| DOW numbering | 1=Sun … 7=Sat | 0=Sun … 6=Sat |
| DOM vs DOW | One must be `?` | OR when both restricted |
| `L`, `W`, `#`, `LW` | Yes | No |
Examples
0 0 12 * * ? 2026Daily at noon, but only in 2026 (7-field form).Gotchas & Pitfalls
- ⚠Day-of-week is 1-indexed with Sun=1 — opposite of Unix cron where Sun=0.
- ⚠Either DOM or DOW must be `?`. `* * * * * *` is invalid in Quartz.
- ⚠The seconds field means a job can fire 60 times per minute — be careful with expensive triggers.
- ⚠`L` in DOW means Saturday (last day of week, value 7), NOT “last day of week of month”. Use `6L` for “last Friday”.