Cron expressions
Learn how to use cron expressions in Actioner.
Overview
A cron expression is a set of values representing a schedule that specifies the times at which a recurring job should be executed.
It consists of fields that define the minute, hour, day of the month, month, day of the week and the year when the workflow should run.
Where it is used
Cron expressions are used in recurring jobs, which allows you to schedule your workflows by specifying when they should run. You can leverage cron expressions to define precise schedules for workflows in your apps.
Cron expression reference
Structure of a cron expression
Each field in the cron expression can contain specific values, special characters, or ranges to define the timing of the workflow execution. A cron expression consists of below fields:
Field | Values | Special characters |
---|---|---|
Minutes | 0-59 | , - * / |
Hours | 0-23 | , - * / |
Day of month | 1-31 | , - * ? / L W |
Month | 1-12 or JAN-DEC | , - * / |
Day of week | 1-7 or SUN-SAT | , - * ? L # |
Year | 1970-2199 | , - * / |
Special characters
,
(comma) includes additional values. In Month field,JAN,FEB,MAR
includes January, February, and March.-
(dash) specifies ranges. In Day field,1-15
includes days 1 through 15 of the specified month.*
(asterisk) includes all values in the field. In Hours field,*
includes every hour. You can't use*
in both Day of month and Day of week fields. If you use it in one, you must use?
in the other./
(slash) specifies increments. In Minutes field, you could enter1/10
to specify every tenth minute, starting from the first minute of the hour (for example, the 11th, 21st, and 31st minute, and so on).?
(question mark) specifies any. In Day of month field, you could enter7
and if any day of the week was acceptable, you could enter?
in Day of week field.L
in Day of month or Day of week fields specifies the last day of the month or week.W
in Day of month field specifies a weekday. In Day of month field,3W
specifies the weekday closest to the third day of the month.#
in Day of week field specifies a certain instance of the specified day of the week within a month. For example,3#2
would be the second Tuesday of the month: the3
refers to Tuesday because it is the third day of each week, and the2
refers to the second day of that type within the month.
If you use a #
character, you can define only one expression in the Day of week field. For example, 3#1,6#3
is not valid because it is interpreted as two expressions.
Limitations
- You can't specify Day of month and Day of week fields in the same cron expression. If you specify a value or a
*
(asterisk) in one of the fields, you must use a?
(question mark) in the other. - Cron expressions that lead to rates faster than 1 minute are not supported.
Examples
You can use the following sample cron expressions when creating a recurring job.
Minutes | Hours | Day of month | Month | Day of week | Year | Meaning |
---|---|---|---|---|---|---|
0 | 10 | * | * | ? | * | Run at 10:00 am (UTC+0) every day |
15 | 12 | * | * | ? | * | Run at 12:15 pm (UTC+0) every day |
0 | 18 | ? | * | MON-FRI | * | Run at 6:00 pm (UTC+0) every Monday through Friday |
0 | 8 | 1 | * | ? | * | Run at 8:00 am (UTC+0) every 1st day of the month |
0/15 | * | * | * | ? | * | Run every 15 minutes |
0/10 | * | ? | * | MON-FRI | * | Run every 10 minutes Monday through Friday |
0/5 | 8-17 | ? | * | MON-FRI | * | Run every 5 minutes Monday through Friday between 8:00 am and 5:55 pm (UTC+0) |
0/30 | 20-2 | ? | * | MON-FRI | * | Run every 30 minutes Monday through Friday between 10:00 pm on the starting day to 2:00 am on the following day (UTC) |