Using Cron expressions

Cron expressions provide a flexible way to schedule jobs to run at unusual or semi-regular times.

Cron expressions are made up of six parameters that are separated by single white spaces. Each parameter represents an element of time. Together, the six time parameters specify the months, days, hours, minutes, and seconds when the job runs. This table shows these parameters in the order that they appear in Cron expressions:
Table 1. Cron expression
Position in Cron expression Time parameter Valid range
1 Second 0-59
2 Minute 0-59
3 Hour 0-23
4 Day of the month 1-31
5 Month 1-12
6 Day of the week 1-7 (where 1 represents Sunday)
For each parameter, you can use the following characters to specify ranges and frequencies:
Table 2. Specify ranges and frequencies
Character Purpose
* Indicates that the job runs on every occurrence of the time parameter.
, Separates a list of values in the parameter.
- Allows a range of values to be specified in the parameter.
/ Allows intervals to be specified in the parameter.

For example, you might use the following Cron expression to specify that a job must run every four hours at 20 minutes past the hour:

0 20 */4 * * *

View these example expressions to learn more:

Table 3. Example expressions
Expression Meaning
*/30 * * * *

The job runs every 30 seconds.

1 0 0 * * 2-6

The job runs at one second past midnight on every weekday.

0 20 4 * * *

The job runs at 4:20 AM every day.

0 */15 15-17 * * *

The job runs every 15 minutes between 3 and 5 PM.

0 30 5 15 * *

The job runs at 5:30 AM on the 15th of every month.