Cron Expression: 9 to 5 on Weekdays
The 9-to-5 workday expression is 0 9-17 * * 1-5 — the top of every hour from 9am to 5pm, Monday to Friday. Paste it above to read it in English and preview the next runs. Below: the inclusive-range catch and weekday numbering.
The expression
0 9-17 * * 1-5 runs a job at the top of every hour from 9am through 5pm, Monday to Friday. That is 9 fires a day (09:00, 10:00 … 17:00) on each weekday.
Field by field
0 is the minute (on the hour), 9-17 is the hour range, the two * cover every day-of-month and month, and 1-5 is Monday through Friday.
The inclusive-range catch
Ranges in cron are inclusive on both ends, so 9-17 includes 17:00 — the last run is at 5pm sharp, not 4pm. If you want the job to stop before 5pm, use 9-16.
Weekday numbering
1-5 is Monday–Friday (0 and 7 are both Sunday). Drop the weekday field to * to run every day of the week: 0 9-17 * * *.
Common variations
Every 30 minutes during business hours: */30 9-17 * * 1-5. Only at 9am and 5pm: 0 9,17 * * 1-5.
FAQ
What is the cron expression for 9 to 5 on weekdays?
0 9-17 * * 1-5 runs on the hour from 9am to 5pm, Monday through Friday — nine runs per weekday.
Does 9-17 include 5pm?
Yes. Cron ranges are inclusive, so 9-17 fires at 17:00 (5pm). Use 9-16 to stop the hour before.
How do I run every 30 minutes during business hours?
Use */30 9-17 * * 1-5 to fire at :00 and :30 of every hour from 9am to 5pm on weekdays.