Skip to main content

Cron Expressions

Cron expressions are used to define the schedule of a plan (the frequency of the plan execution). Besides the Cron expression you can also define a delay in the plan execution. The delay is used to create more complex schedules. It can be set to a number (positive or negative) of minutes, hours, days, or weeks.

info

Plans cannot be executed more often than every three hours.

Format​

Cron expressions are strings that consist of five fields separated by white space.

Field name

Allowed values

Allowed special characters

Minutes

0-59

* , - /

Hours

0-23

* , - /

Day of month

1-31

* , - / L W

Month

1-12 or JAN-DEC

* , - /

Day of week

0-6 or MON-SUN

* , - / L #

Special characters​

Asterisk ( * )​

Asterisks indicate that the cron expression matches all field values. E.g., using an asterisk in the 5th field (day of week) indicates every day.

Slash ( / )​

Slashes describe increments of ranges. For example, 0-12/2 in the hour field is the same as 0,2,4,6,8,10,12 (every 2 hours from 00:00 AM to 12:00 PM, inclusive).

Comma ( , )​

Commas are used to separate items of a list. For example, using JAN,MAY,NOV in the 4th field (month) means January, May, and November.

Hyphen ( - )​

Hyphens define ranges. For example, 14-17 in the 2nd field (hours) indicates every hour between 14:00 PM and 17:00 PM, inclusive.

L​

L means the last day of the month or the last day of the week (MON-SAT) in the month. When used in the day of week field combined with a number, 1L, it simply means "the last Monday" of a given month. However, when used in the day of month field alone, it indicates the month's final day.

W​

W means weekday (Monday-Friday) nearest to the given day. When used in the day of month field by itself (e.g., 5W), it specifies a weekday (Monday-Friday) nearest to the 5th of the month. When combined with L, it means "the last business day of the month."

Hash ( # )​

Hashes are used in the day of week field to specify the nth day of the month. For example, 6#3 means the third Saturday of the month (day 6 = Saturday and "#3" = the 3rd (day) of the month).

Examples​

Below you can find some examples of Cron expressions. You can use them as a reference when creating your own.

Verbal Description

CRON Expression

At 11:00 PM, between days 11 and 17 of the month, and on Friday

0 23 11-17 * FRI

At 06:00 PM, only in October

0 18 * 10 *

At 12:00 AM, only on Saturday every six months

0 0 * */6 6

At 12:00 AM every six months

0 0 * */6 *

At 01:00 AM, on the fourth Saturday of the month

0 1 * * SAT#4

At 11:00 AM, on the second Tuesday of the month, only in February, May, August, and November

0 11 * 2,5,8,11 TUE#2

Three days after Patch Tuesday (you can do it using Delay)

Cron: 0 0 * * TUE#2
Delay: Three days

At 12:00 AM, on the first Saturday of every month

0 0 * * SAT#1

At 12:00 AM, on the third Friday of every three months

0 0 * */3 5#3