Cron Expression Generator · Tutorial

How to write a cron job for working hours on weekdays

5 min readbeginnerUpdated

You want a sync job to run every 15 minutes, but only during office hours on weekdays. This tutorial builds the expression field by field, checks the plain-English description, and confirms the run times in the scheduler's time zone.

What you need

Steps

  1. Set the minutes

    In the Minute field enter */15. That means minutes 0, 15, 30 and 45 of each hour.

  2. Limit the hours

    In Hour enter 9-17. The job then runs from 09:00 until the last quarter-hour of 17, which is 17:45.

  3. Choose the days

    Leave day of month and month as *, and set Day of week to 1-5 (or MON-FRI). The full expression is shown at the top.

    */15 9-17 * * 1-5
  4. Read the description

    The tool shows "Every 15 minutes, from 09:00 to 17:59, on Monday to Friday." If the wording isn't what you meant, adjust the fields.

  5. Check the next runs

    Choose your scheduler's zone, often UTC for cloud services, under Show next runs in time zone. The list shows the next eight times the job will fire.

Try it yourself

Opens the Cron Expression Generator with this tutorial's sample loaded.

Try it now

Common mistakes

Using 9-17 when you mean until 17:00
The range includes hour 17, so runs continue until 17:45. Use 9-16 to stop at 16:45.
Writing */15 in the hour field
That means every 15 hours (00:00 and 15:00), not every 15 minutes.
Ignoring the server's time zone
Cron runs in the scheduler's zone, which is often UTC. A job meant for 09:00 London time runs at 10:00 London time in summer if the scheduler uses UTC.

Next steps

Go back to the Cron Expression Generator, or keep going with one of these: