Skip to content

Cron Expression Basics

DataKitchen's DataOps Automation uses the Kubernetes scheduler for order scheduling.

The system translates standard cron syntax and time zone definitions to set the date/time for scheduled order runs.

Cron fields

Automation cron expressions are strings of five fields separated by spaces: <minute> <hour> <day-of-month> <month> <day-of-week>

Where:

  • minute = 0-59
  • hour = 0-23
  • day-of-month = 1-31
  • month = 1-12 or JAN-DEC
  • day-of-week = 0-7 or SUN-SAT (Sunday can be represented by either 0 or 7 or SUN)

Considerations

  • Multiple days can be listed as strings or numerals, as in MON,WED,THU or 1,3,4 and MON-THU or 1-4.
  • String literals are case-insensitive, so THU, thu, and Thu are all valid syntax for Thursday.
  • Automation does not support the second and year fields found in some cron implementations.

Cron characters

Character Use
Asterisk (*) Means "all," as in the order should run for every unit of time where the asterisk appears in the expression.
Dash (-) Means "range," as in a range of units of time. For example, "1-4" in the day-of-week field sets the schedule for Monday through Thursday.

NOTE: commas and dashes cannot be used together for non-UTC time zones. Dashes are not supported in day-of-month or day-of-week fields if there is hour overflow
Comma (,) Separates multiple values in a unit of time. For example, "MON, WED, FRI" in the day-of-week field sets the schedule to run on those three days.

NOTE: commas and dashes cannot be used together for non-UTC time zones.
Forward slash (/) Defines the starting value and incremental or step value in a unit of time.

For example, "5/15" in the minute field sets the schedule to run at the 5, 20, 35, and 50 minute marks of an hour.

Warning

Characters fail with non-UTC time zones. At this time, the DataOps Automation cron scheduler does not support the use of commas and dashes together when schedules are set using non-UTC time zones. Use the UTC time zone with complex schedules, as in "2,5,15-45/2 2 1-5,7,31 MAR,DEC WED".

Time zones

While the Automation scheduler supports many time zones, due to the translations the system must perform, there are limitations when using certain cron syntax with non-UTC time zones.

Schedules with non-UTC time zones cannot include cron expressions with both commas and dashes.

UTC workaround

As a workaround, select UTC for the Time Zone, then write a cron expression with the appropriate hours pre-translated.

Visual example in Automation

(Screenshot of the schedule form with UTC workaround)

Examples of supported cron expressions

The syntax follows this field order: <minute> <hour> <day-of-month> <month> <day-of-week>

Tip

See crontab.guru for additional help in translating cron expressions.

Expression Definition
0 15 * * * At 3:00 pm every day
30 9 * * MON-FRI 30 9 * * 1-5 Both run at 9:30 am every Mon, Tue, Wed, Thurs, and Fri
15,45 7 * 4 TUE At 7:15 am and 7:45 am every Tuesday in April
0 6,18 15 * * At 6:00 am and 6:00 pm on the 15th day of every month
0 0 10/5 * * At 00:00 on every 5th day-of-month from 10 through 31

Examples with UTC

Standard time zone expression UTC time zone expression
30 09 * * * At 9:30 am every day, EST (America/New_York, UTC-05:00) 30 14 * * * At 14:30 every day, UTC
15,45 22 * * TUE At 10:15 pm and 10:45 pm every Tue, EST (America/New_York, UTC-05:00) 15,45 3 * * WED At 03:15 and 03:45 every Wed, UTC (UTC translation shifts to the next day)

What is Automation?

Schedules

Orders

Cron Expressions in DataOps Observability