How to Read a Cron Expression
By Tools Star Hub Editorial Team · Published
A cron expression on this page is five numbers or stars: minute, hour, day of month, month, and day of week. Sunday is 0 and Saturday is 6. Names such as MON or JAN are not accepted, and a sixth field for seconds is not accepted.
The field that surprises people is the pair of day fields. When both the day of month and the day of week are set to something other than a star, cron matches either day, not both. 0 9 1 * 1 means 09:00 on the 1st of the month or on Monday. It does not mean only a Monday that falls on the 1st.
How to build or explain a cron expression
- Choose Build or Explain. Build fills the five fields and writes the expression. Explain takes an expression you paste and writes a plain-language summary. Both stay in the browser tab.
- Fill minute, hour, day of month, month, and day of week. A star means every value in that field. A single number picks one value. A range such as 1-5 picks the values from the start through the end. A comma list picks those values. A star step such as */15 means every 15 of that field. Minute runs from 0 to 59, hour from 0 to 23, day of month from 1 to 31, month from 1 to 12, and day of week from 0 to 6.
- Read the summary before you copy the expression. */15 * * * * means every 15 minutes. 0 9 * * 1-5 means at 09:00 on Monday through Friday. If both day fields are restricted, the summary says cron treats that as either day, not both.
- Copy the five fields into the scheduler yourself. The page writes the text. It does not install the schedule, and it does not send the expression to a server.
Example
Weekdays at 09:00
0 9 * * 1-5 is minute 0, hour 9, any day of month, any month, and Monday through Friday. Sunday is 0, so 1-5 is Monday through Friday. Saturday would be 6.
The 1st or Monday, not only a Monday the 1st
0 9 1 * 1 is 09:00 on day 1 of the month or on Monday. A Monday that is not the 1st still matches. The 1st still matches when it is not a Monday.
Things to watch
Names, seconds, and day 7
MON, JAN, and other names are rejected. A leading seconds field makes six fields, and six fields are rejected. Day of week 7 is rejected. Sunday is 0.
A step inside a range
*/15 is accepted. A step inside a range, such as 0-30/10, is rejected. Lists are limited to 12 values in one field. The whole expression can be at most 200 characters.
FAQ
- Does 0 9 1 * 1 run only when the 1st is a Monday?
- No. Cron matches either day, not both. 0 9 1 * 1 means 09:00 on the 1st of the month or on Monday. It does not mean only a Monday that falls on the 1st.
- What does Sunday as 7 do?
- It is rejected. On this page Sunday is 0 and Saturday is 6. A day-of-week value of 7 is outside that range.
- Why was 0-30/10 rejected?
- That is a step inside a range. This page accepts a star step such as */15. It does not accept a range with a step, such as 0-30/10.
- Does the page install the schedule?
- No. It builds or explains the five fields in this browser tab. You copy the expression into the scheduler yourself.
To build or explain a five-field expression, use the Cron Expression Generator. It runs in the browser and does not require an account.