Scheduling parameters are the core mechanism in DataWorks for dynamic task and configuration management. They let you use variable placeholders in your code and inject dynamic values during scheduling. This solves the challenge of maintaining hardcoded dates in periodic tasks and separates configuration from code using a four-tier parameter hierarchy: workspace, workflow, node context, and node-local. This separation greatly enhances task flexibility, reusability, and adaptability across different environments.
This article focuses on the assignment sources and expression syntax for scheduling parameters. Before reading this article, make sure that you are familiar with the basic configuration methods described in Configure and use scheduling parameters.
Scheduling parameter sources
Besides using parameters defined locally on a node, you can also use context, workflow, and workspace parameters. These sources are listed below in order of scope, from narrowest to broadest.
-
Node-local definition (current node)
Parameters defined in the Scheduling Parameters area of the Scheduling Configuration section apply only to the current node. They support a rich set of parameter expressions, as detailed below.
-
Context parameters (passed across nodes)
Use context parameters to receive output values from upstream nodes. This not only passes values but also establishes a dependency between the nodes. Use this method when a parameter's value must be dynamically determined by the result of an upstream task. You can quickly add a context parameter by clicking the
icon in the parameter assignment area. For more information, see Configure and use node context parameters
.
-
Workflow parameters (shared within a workflow)
Parameters defined at the workflow level are available to all nodes within that workflow. You can reference them directly using the format
${workflow.Parameter name}. The parameter expression rules described in this article also apply to workflow parameters.
-
Workspace parameters (shared within a workspace)
Workspace parameters are global parameters defined at the workspace level, making them available to all nodes within that workspace. Their most common use is to differentiate configurations between development and production environments. For example, you can define a parameter named
db_namewith a value ofdb_devin the development environment anddb_prodin the production environment. When setting a scheduling parameter's value, you can directly select Workspace Parameters . For details, see Use workspace parameters .
Parameter expressions
Scheduling parameters define assignment logic by specifying a parameter name and a parameter value. The parameter value supports multiple forms, including time parameters, built-in system parameters, and constants. After the parameters are defined, you can reference them in your code by using the ${parameter name} format.
-
Custom time parameters: Such as
${...}and$[...], which allow you to transform values based on two time references (business date and scheduled time). For details, see Time parameters. -
Built-in system parameters: Such as $bizdate, $bizmonth, and $jobid, which can be used to retrieve the business date, business month, workflow ID, and more. They are not limited to time-related values. For details, see Built-in scheduling parameters.
-
Constants: Such as '
123','abc', and so on.
Among these, time parameters are the primary use case for scheduling parameters. They are used to dynamically replace various time strings when tasks run.
Time parameters
Core concept: Time reference
All dynamic time parameters in DataWorks are based on the following two core time references.
|
Concept |
Definition |
Parameter value |
Custom format |
Time precision |
|
Business date |
Typically refers to the day before the scheduled run date of a task. In T+1 batch computing scenarios, it represents the date on which the business data was generated. For example, if you run a task today to calculate the previous day's revenue, the previous day — the date when the transactions occurred — is the business date. |
|
|
Year, month, day |
|
Scheduled time |
Refers to the time configured in the Scheduling Settings section of a node via the cron expression. At task runtime, it is replaced with the day on which the task instance is scheduled to run. It is precise to the second and is independent of the actual execution time. This time represents the expected execution time of the task, which may not exactly match the actual start time. The actual start time is affected by multiple factors. |
|
|
Year, month, day, hour, minute, second |
Summary:
-
Business date ≈ yesterday (the date of the data) =
$bizdate=${yyyymmdd} -
Scheduled time ≈ today (the time the task runs) =
$cyctime=$[yyyymmddhh24miss]
A typical T+1 task works as follows: at the early hours of today (scheduled time), a task is triggered to process yesterday's (business date) data.
The following shows the parameter definitions for $bizdate and ${yyyymmdd}, $cyctime and $[yyyymmddhh24miss], along with their preview results when the business date is 2025-10-16.
|
|
|
If the default return value of the base time parameter does not meet your requirements, you can customize time parameters by using ${...} and $[...]. Custom time parameters are derived by transforming the two base time references. The following methods are supported:
When assigning values to scheduling parameters using custom expressions, make sure to distinguish between the two bracket formats: {...} and [...]. The two formats use different base time references and return entirely different values. Mixing them up may cause production data errors.
Custom time parameters
DataWorks supports using ${...} and $[...] to retrieve the business date and scheduled time, respectively. The following transformation types allow you to flexibly modify time values to meet your business requirements. The following examples assume a daily schedule with a scheduled time of 02:30:45 and a business date of 20251031. The base time references are:
-
Business date: ${yyyymmdd}, for example, 20251031.
-
Scheduled time: $[yyyymmddhh24miss], for example, 20251101023045.
ImportantThe scheduled time is the preset scheduling time, which is fixed when the task instance is generated. If a task instance is delayed due to resource constraints or upstream node status, the scheduled time does not change with the actual run time of the instance.
${...} vs. $[...] key differences
First, understand the key differences between the two. ${...} and $[...] differ fundamentally in their time references and calculation capabilities. Mixing these two formats may cause data errors.
|
Dimension |
|
|
|
Time reference |
Business date (T-1) |
Scheduled time (T) |
|
Time precision |
Day (year, month, day) |
Second (year, month, day, hour, minute, second) |
|
Offset calculation capability |
Supports offset calculations for year, month, week, and day. |
Supports offset calculations for day, hour, and minute. |
|
Key limitation |
Does not support formatting or offset calculations for smaller time units such as hour, minute, and second. |
Does not support using the |
|
Default equivalent |
|
|
Time formatting
Use curly braces ${...} or square brackets $[...], combined with yyyy, yy, mm, and dd in custom combinations to generate time parameters that retrieve dates a certain number of years, months, or days before or after the business date.
|
Code |
Description |
|
|
||
|
Assignment |
Result |
Assignment |
Result |
||
|
|
4-digit year |
|
|
|
|
|
|
2-digit month |
|
|
|
|
|
|
2-digit day |
|
|
|
|
|
|
Hour in 24-hour format |
Not supported (day-level precision) |
- |
|
|
|
|
Hour in 12-hour format |
- |
|
|
|
|
|
Minute |
- |
|
|
|
|
|
Second |
- |
|
|
|
|
|
Year and month |
|
|
|
|
|
|
Formatted with hyphens as delimiters |
|
|
|
|
|
|
Formatted with hyphens, including hours, minutes, and seconds |
Not supported (day-level precision) |
- |
For the supported method, see String concatenation: Method 2. |
|
Offset calculation
Offset calculation is the core of dynamic parameters. You can add or subtract values from the business date or scheduled time to retrieve dates and times N years, months, days, hours, or minutes before or after the base time (hours and minutes are supported only for the scheduled time). ${...} and $[...] support different ranges due to the different precision of their base time references.
-
${...}offset calculation-
Core capability: Supports integer offset for year, month, week, and day.
ImportantDoes not support hour or minute offset calculations. Expressions such as ${yyyy-mm-dd-1/24} are not supported.
-
Syntax:
${<time format><±N>}, where N corresponds to the smallest unit in the time format. For example, if the format is yyyymm, N is in months. If the format is yyyymmdd, N is in days.Date offset period
Offset unit
Syntax
Example
N years before/after
Year
${yyyy±N}or${yy±N}Get the previous year:
${yyyy-1}N months before/after
Month
${yyyymm±N}
Get the previous month:
${yyyymm-1}N weeks before/after
Week
${yyyymmdd±7*N}
Get the previous week:
${yyyymmdd-7*1}N days before/after
Day
${yyyymmdd±N}
Get the day before yesterday:
${yyyymmdd-1}
-
-
$[...]offset calculation-
Core capability: Supports fractional offset for day, hour, and minute.
Important$[...]cannot use the$[yyyy-N]or$[mm-N]time format to retrieve dates N years or N months ago. To perform year or month offset calculations, use theadd_monthsfunction. -
Syntax:
$[<time format><±N>], where N/24 is used for hour offsets and N/24/60 is used for minute offsets. N is the number of hours or minutes to offset.Requirement
Offset unit
Syntax
Example
N years before/after
Year
$[add_months(yyyymmdd,12*N)](N years after)$[add_months(yyyymmdd,-12*N)](N years before)Get the previous year:
$[add_months(yyyymmdd,-12)]N months before/after
Month
$[add_months(yyyymmdd,N)](N months after)$[add_months(yyyymmdd,-N)](N months before)Get the previous month:
$[add_months(yyyymmdd,-1)]N weeks before/after
Week
$[yyyymmdd±7*N]Get the previous week:
$[yyyymmdd±7*1]N days before/after
Day
$[yyyymmdd±N]Get yesterday:
$[yyyymmdd-1]N hours before/after
Hour
You can retrieve this time data using the following methods:
-
$[hh24miss±N/24],$[hh24±N/24] -
$[custom time format±N/24]
Get the previous hour using different time formats:
-
Get month:
$[mm-1/24]. -
Get year:
$[yyyy-1/24]. -
Get year and month:
$[yyyymm-1/24]. -
Get year, month, and day:
$[yyyymmdd-1/24]. -
Get the previous day and previous hour:
$[yyyymmdd-1-1/24]
N minutes before/after
Minute
You can retrieve this time data using the following methods:
-
$[hh24miss±N/24/60] -
$[yyyymmddhh24miss±N/24/60] -
$[mi±N/24/60] -
$[custom time format±N/24/60]
Get 15 minutes before the scheduled time using different time formats:
-
$[yyyy-15/24/60] -
$[yyyymm-15/24/60] -
$[yyyymmdd-15/24/60] -
$[hh24-15/24/60] -
$[mi-15/24/60]
Complex combined offset
Day + Hour
$[yyyymmdd±N±M/24], where N is the day offset and M is the hour offset.Example: Get one day before and one hour before →
$[yyyymmdd-1-1/24]Note-
When performing hour or minute offset calculations, day boundary crossing may occur. For information about how parameters handle day boundary crossing, see Handle day boundary crossing in time parameters.
-
When performing a month offset calculation on an end-of-month date, if the target month does not have the corresponding day, the result is automatically adjusted to the last day of that month. For example, if the current date is 2025-03-31 and a 1-month backward offset is applied, the result is 2025-02-28 because February does not have a 31st day.
-
-
Secondary transformation using engine functions
When the built-in formatting and offset of scheduling parameters cannot directly produce the desired value (such as the last day of the previous month), you can use functions built into the compute engine of the target node or use an assignment node to perform secondary transformations on time parameters when calling them.
For more information, see Perform secondary transformation using engine functions.
String concatenation
Use this method to construct date strings with patterns that the built-in syntax does not support. It combines the date portion generated by scheduling parameters with fixed constant strings.
Example 1: Dynamically get the first day of each month.
-
Scenario: Regardless of the day the task runs, you need a string representing the first day of the current month in the format
yyyymm01. -
Implementation:
-
Extract the year and month: Use
${yyyymm}to get the year and month of the current business date (for example, if the business date is20231027, the result is202310). -
Concatenate the constant: Concatenate the extracted year and month with the string
'01'. -
Parameter call:
first_day_of_month=${yyyymm}01
-
-
Result: When the task runs,
${first_day_of_month}is replaced with20231001.
Example 2: Get the time in yyyy-mm-dd hh24:mi:ss format.
-
Scenario: Get a time string in
yyyy-mm-dd hh24:mi:ssformat, such as2023-11-01 02:30:45. -
Implementation:
-
Define two parameters:
datetime1anddatetime2, and assign them asdatetime1=$[yyyy-mm-dd]anddatetime2=$[hh24:mi:ss-1/24/60]. -
Concatenate the parameters: Concatenate
datetime1anddatetime2with a space. -
Parameter call: pt=
${datetime1}${datetime2}.
-
-
Result: When the task runs,
${datetime1}${datetime2}is replaced with2023-11-01 02:30:45.
Built-in scheduling parameters
DataWorks supports the following built-in system parameters, which can be used as scheduling parameter values. However, this approach is less flexible because the time format is fixed. We recommend that you use custom time parameters, which support flexible transformations.
|
Built-in parameter |
Definition |
|
$bizdate |
The business date, in the format This parameter is widely used. In daily scheduling, the business date defaults to the day before the expected task run date. |
|
$cyctime |
The scheduled time of the task, in the format |
|
$gmtdate |
The current date, in the format This parameter defaults to the current date. When you backfill data, the input date is |
|
$bizmonth |
The business month, in the format
|
|
$jobid |
The ID of the workflow to which the task belongs. |
|
$nodeid |
The node ID. |
|
$taskid |
The instance ID generated by the node. |
Appendix
Parameter replacement during data backfill
After a task is submitted to Operation Center, you can backfill data to batch-generate and run historical task instances within a specified date range for data repair, backfilling, or retrospective analysis.
-
Business date ($bizdate): During data backfill, the business date you select is consistent with the replacement result of $bizdate. If the scheduling parameter uses the
${...}custom format, the base time is the selected date, which is then transformed according to the specified time expression. -
Scheduled time ($cyctime): During data backfill, the replacement result of $cyctime is
the selected business date + 1day.For example, if the business date selected for data backfill is
20250315, then during data backfill, the replacement result of the$cyctimeparameter is20250316000000. If the scheduling parameter uses the$[...]format, the base time is the selected business date + 1, which is then transformed according to the specified time expression.
Relationship between scheduling parameters, business date, scheduled time, and actual run time
|
Relationship type |
Description and example |
|
Relationship between scheduling parameters and actual run time. |
The replacement values of scheduling parameters are determined when instances are generated. Therefore, the replacement values do not change with the actual run time of the instance. |
|
Relationship between scheduling parameters and scheduled time. |
When a scheduling parameter is set to For example, if the current node is an hourly scheduled node with a scheduled time range of
|
|
Relationship between scheduling parameters, business date, and scheduled time. |
|
Daylight saving time notes
DataWorks ensures that tasks run correctly on the days when daylight saving time (DST) begins and ends. For details about how the product handles DST transitions, see Daylight saving time. To avoid additional complexity caused by DST transitions on your task execution, we recommend that you review this document if your region observes DST.
Value comparison of custom parameters
This section uses an ODPS SQL node as an example. Assuming the task's scheduled time is July 20, 2025 10:30:00, the following table shows the time value configurations for ${…} and $[…] parameters.
|
Time value |
${…} parameter |
$[…] parameter |
|
Get year: 2025 |
|
|
|
Get year: 25 |
|
|
|
Get year: 2024 |
|
|
|
Get month: 07 |
|
|
|
Get day: 20 |
|
|
|
Get date: June 20, 2025 |
Important This approach requires consideration of the number of days in each month and is not recommended. We recommend that you use the |
|
|
Get date: July 19, 2025 |
|
|
|
Get date: July 20, 2024 |
Important This approach requires consideration of leap years and is not recommended. We recommend that you use the |
|
|
Get time: 10:30:00 |
Not supported |
|
|
Get time: 2025-07-20 10:30:00 |
Not supported |
|
|
Get time: 2025-07-20 10:29:00 |
Not supported |
|
|
Get time: 2025-07-20 09:30:00 |
Not supported |
|
|
Get the previous day's time, precise to seconds, with no space between date and time: 2025071910:30:00 |
Not supported |
|
|
Get the previous day's time, precise to seconds, with a space between date and time: 20250719 10:30:00 |
Not supported |
|

