Learn the cron expression syntax for scheduling tasks in DataWorks, including field definitions, special characters, and common examples.
Overview
Using a custom expression for the scheduling time is an invitation-only beta feature. To use this feature, contact technical support.
DataWorks defines task scheduling time through a form or a custom expression (time property configuration). Cron expressions follow the standard Spring Cron format (CronSequenceGenerator), extended to support last-day-of-month and Nth-weekday-of-month scheduling.
Note: Switching between form and custom expression modes resets the scheduling time to the default value (00 00 00 * * ?). You must reconfigure it after switching.
Cron expressions support flexible scheduling. You can:
-
Specify exact dates
-
Handle month-end processing (using
L) -
Combine multiple values (for example,
1,3) -
Specify the last day of the week in a month (
L) or the Nth day of the week in a month (#)
DataWorks uses a six-field format:
second minute hour day of month month day of week
Example: Run a task at 01:00:00 on the 1st and 3rd of every month.
00 00 01 1,3 * ?
-
Second-level scheduling is not supported. The second field must be 00.
-
The year field is not supported. All tasks run annually by default.
Field reference
|
Position |
Field |
Value range |
Special characters |
Description |
|
1 |
second |
|
- |
Not configurable. |
|
2 |
minute |
|
|
- |
|
3 |
hour |
|
|
24-hour clock |
|
4 |
day of month |
|
|
Specifies the day of the month. L indicates the last day of the month. |
|
5 |
month |
|
|
- |
|
6 |
day of week |
Important
English abbreviations (such as |
|
|
Special characters
|
Character |
Name |
Description |
|
|
Wildcard |
Represents all possible values. For example, |
|
|
No specific value |
Used in the |
|
|
Range |
Specifies a contiguous range. For example, |
|
|
List |
Specifies discrete values. For example, |
|
|
Increment |
Defines a step interval. For example, |
|
|
Last |
|
|
|
Nth Day |
Used in the |
Syntax details and examples
1. Enumerate multiple dates: ,
00 00 00 1,15 * ?
Run at 00:00:00 on the 1st and 15th of every month (commonly used for bimonthly paydays or reconciliation)
2. Use L: Last day of the month or last day of the week in a month
00 00 00 L * ?
Run at 00:00:00 on the last day of every month (month-end settlement)
00 00 00 * * 7L
Run at 00:00:00 on the last Saturday of every month
00 00 00 ? * 2L
Run at 00:00:00 on the last Monday of every month
3. Use #: Nth day of the week in a month
00 00 00 ? * 3#2
Run at 00:00:00 on the second Tuesday of every month
00 00 00 * * 6#3
Run at 00:00:00 on the third Saturday of every month
⚠️ If the fifth Saturday does not exist in a given month, the task is skipped for that month.
4. Combined expressions (recommended for complex schedules)
00 00 00 1,3 * 6L
Run at 00:00:00 on the 1st, 3rd, and last Friday of every month
Common use cases
|
Cron expression |
Description |
|
|
Run at 02:00:00 every day. |
|
|
Run at 10:15:00 every day. |
|
|
Run every 5 minutes from 14:00 to 15:00 every day. |
|
|
Run at 01:00:00 every Monday. |
|
|
Run at 02:00:00 and 04:00:00 every Thursday. |
|
|
Run at 02:00:00 on the last day of every month. |
|
|
Run at 02:00:00 on the last Friday of every month. |
|
|
Run at 01:00:00 on the first Wednesday of every month. |
|
|
Run at 01:00:00 on the 3rd and the first Wednesday of every month. |