Skip to main content
hank-builds.com
Home Dev ToolsCron Expression Parser

Cron Expression Parser

Cron Expression Parser

Schedule

At 09:00 on Mon–Fri

minute
0-59
hour
0-23
day
1-31
month
1-12
weekday
0-6
Need a full color palette?Color Palette Generator

Reading a cron expression

A standard cron expression is five fields separated by spaces: minute, hour, day of month, month, and day of week, in that order. Each field is either a wildcard, a single value, a list, a range, or a step. The job runs whenever the current time matches every field.

The field most people get wrong is the last one. Day of week runs 0–6 with Sunday as 0, and in most implementations 7 also means Sunday. Getting it one out is why a job intended for Monday runs on Sunday.

Worked examples

ExpressionMeaning
*/5 * * * *Every 5 minutes
0 * * * *At minute 0 of every hour
0 0 * * *At midnight
0 12 * * *At noon
0 9 * * 1-5At 09:00 on Mon–FriThe usual weekday-morning job.
0 0 1 * *At midnight on day 1 of the month
30 2 * * 0At 02:30 on SunA weekly maintenance window.

The five fields

PositionFieldAllowed values
1Minute0–59
2Hour0–23
3Day of month1–31
4Month1–12
5Day of week0–6, Sunday = 0

Some implementations add a sixth leading field for seconds. Quartz and Spring do; standard Unix cron does not.

Worth knowing

  • Field ranges: minute 0–59, hour 0–23, day of month 1–31, month 1–12, day of week 0–6 (Sunday is 0).
  • * means every value. */5 means every fifth value. 1-5 is a range. 1,3,5 is a list. They combine: 0,30 9-17 * * 1-5.
  • When both day-of-month and day-of-week are restricted, standard cron treats them as OR, not AND. 0 0 13 * 5 runs on the 13th of every month and on every Friday, not only on Friday the 13th. This surprises almost everyone.
  • Cron runs in the server's local timezone unless configured otherwise, which means a daylight saving transition can make a job run twice or not at all.

Frequently asked questions

What do the five fields in a cron expression mean?
In order: minute, hour, day of the month, month, and day of the week. A job runs when the current time matches every field at once. An asterisk in a field means every possible value for that field.
How do I run a job every five minutes?
Use a step in the minute field and wildcards elsewhere. The slash syntax means "every nth value", so a step of five in the minute field fires twelve times an hour, on the hour and every five minutes after.
Why does my job run on the wrong day?
Most often because day of week counts from zero with Sunday as zero, so a value of one is Monday rather than Sunday. The other common cause is that restricting both day-of-month and day-of-week makes standard cron OR them together rather than requiring both, so the job fires on far more days than intended.
What timezone does cron use?
The system timezone of the machine running it, unless the crontab sets one explicitly. That matters twice a year: when clocks go forward a job scheduled in the skipped hour may not run at all, and when they go back it may run twice. Scheduling in UTC avoids both.