ToolConvoyToolConvoyv2.6

What Is a Cron Expression?

A cron expression is a five-field time string that tells Unix-like schedulers when to run a job. We unpack every field, the day-of-week trap, and how to read other people's crontabs.

Advertisement

What Is a Cron Expression?

A cron expression is a tiny five-field string that tells Unix-like schedulers (cron, cronie, systemd timers that take cron syntax, Spring Scheduler, Quartz in standard mode, GitHub Actions schedules, Kubernetes CronJobs) when to run a job. It looks like this:

*/15 9-17 * * 1-5

Five fields, separated by whitespace. Each field is a constraint on a different unit of time, and the expression matches whenever all five constraints are satisfied at the same moment.

The five fields

From left to right:

# Field Allowed values Special characters
1 Minute 0-59 * , - /
2 Hour 0-23 * , - /
3 Day of month 1-31 * , - / ? L W
4 Month 1-12 (or JAN-DEC) * , - /
5 Day of week 0-7 (0 and 7 are Sunday, or SUN-SAT) * , - / ? L #

A field of * means “every value” — every minute, every hour, every day.

What */15 9-17 * * 1-5 actually means

Reading the example:

  • */15 — fires on minutes 0, 15, 30, 45 (every 15th minute, starting from 0).
  • 9-17 — between hour 9 and hour 17 inclusive.
  • * * — every day of the month, every month.
  • 1-5 — Monday through Friday.

Combined: at 09:00, 09:15, 09:30, 09:45, 10:00, …, 17:45, on any Monday through Friday.

Three special characters you’ll see most

  • , — list. 1,15,45 means the 1st, 15th, and 45th minute.
  • - — range. 9-17 is hours 9 through 17 inclusive.
  • / — step. */15 is “every 15”, and you can pair it with a range like 1-30/5 for “every 5 from 1 to 30”.

The day-of-week gotcha

In POSIX cron, both 0 and 7 mean Sunday. Most modern implementations accept English day names (SUN, MON, …) too, but the specific syntax extensions vary by implementation. Quartz and Spring add L (last), W (weekday), and # (nth) which the standard cron does not have. If your schedule matters across systems, stick to the five-field POSIX dialect.

Day-of-month AND day-of-week

When both the day-of-month and day-of-week fields are non-*, cron treats them as OR, not AND. So 0 0 1 * 1 means “the 1st of the month OR any Monday at midnight”, not “the first Monday of the month”. To express “first Monday of the month” you need Quartz’s # extension (0 0 * * 1#1).

Tools

For a built-in browser-based cron editor that lists the next five fire times and validates each field, see the Cron Generator tool on this site. It runs entirely client-side and works without registration.

For the bigger picture on time, scheduling, and date math across the site, see the Time and Cron hub.

See also

Related tools

Related hubs

Advertisement