Developer Tool

Quartz Cron vs Unix Cron

Quartz Scheduler (widely used in Java applications) uses a cron-like syntax that looks familiar but isn't compatible with standard Unix cron — here's exactly where they diverge.

The field count is the first difference

Unix cron uses 5 fields: minute, hour, day-of-month, month, day-of-week. Quartz uses 6 required fields plus an optional 7th: seconds, minute, hour, day-of-month, month, day-of-week, and optionally year. Pasting a standard cron expression into a Quartz-based scheduler (or vice versa) without adjusting the field count is one of the most common migration mistakes when a Java project switches schedulers.

The day-of-month / day-of-week rule is flipped

In Unix cron, at least one of day-of-month or day-of-week must be restricted for the expression to be meaningful, but both being * is allowed (interpreted as "every day"). Quartz explicitly forbids specifying both day-of-month and day-of-week at the same time — exactly one of the two must be the placeholder ? (question mark, a symbol Unix cron doesn't have at all), and the other must carry the actual restriction. This removes the AND/OR ambiguity that trips people up in Unix cron (see the first-Monday-of-the-month page) at the cost of a stricter, less familiar syntax.

Related

Related tools