Scheduling parameters dynamically replace time-based values in your code at runtime, eliminating the need to hard-code dates in recurring workflows. This topic describes the supported formats and usage of parameter values.
Ensure you understand how to configure scheduling parameters. For details, see Configure and use scheduling parameters.
Core concepts: Time baselines
Time parameters dynamically replace time strings at runtime. All time parameters in DataWorks are based on the following two core time baselines.
|
Concept |
Description |
Default |
Custom format |
Precision |
|
Business date |
The day before a task's scheduled run date. In T+1 offline computing scenarios, it represents the date the business data was generated. For example, if you run a task today to calculate yesterday's sales revenue, "yesterday" refers to the date the transactions occurred, which is the business date. |
|
|
Year-month-day |
|
Scheduled time |
The scheduled time set in the task's scheduling configuration. At runtime, the system resolves it to the current day. It represents the task's theoretical run time and does not shift due to resource queuing or delays. |
|
|
Year-month-day-hour-minute-second |
Summary:
-
Business date ≈ Yesterday (the date of the data)
-
Scheduled time ≈ Today (the time the task runs)
A typical T+1 task starts in the early morning of today (the scheduled time) to process data from yesterday (the business date).
Parameter value expression
Scheduling parameters support the following types of values:
-
Custom time parameters: Expressions like
${...}and$[...]that transform values based on the two time baselines: business date and scheduling time. For more information, see Custom time parameters. -
Built-in system parameters: Predefined variables, such as
$bizdate,$bizmonth, and$jobid, that return values such as the business date, business month, or workflow ID. These are not limited to time-based values. For more information, see Built-in system parameters. -
Constants: Literal values, such as
'123'and'abc'.
Special character restrictions: Parameter expressions cannot contain spaces or the equals sign (=).
Usage
You define the assignment logic for a scheduling parameter by specifying a parameter name and parameter value in the . After you define the parameter, you can reference it in your code using the ${parameter name} syntax. For detailed instructions, see Configure and use scheduling parameters.
-
Use the system built-in parameters
$bizdateand$cyctimeto represent the business date and scheduled time. These parameters resolve to the following values:-
$bizdate=${yyyymmdd} -
$cyctime=$[yyyymmddhh24miss]

The preceding examples show the parameter definitions for $bizdate (resolving to ${yyyymmdd}) and $cyctime (resolving to $[yyyymmddhh24miss]), and their preview results when the business date is 2025-10-16.
-
-
If the default base time values do not meet your needs, use the
${...}and$[...]syntax to transform the two base times into custom time parameters.
Custom time parameters
DataWorks supports retrieving the business date and scheduling time using the ${...} and $[...] formats, respectively. These formats allow you to transform time values to meet business requirements. The following examples assume a node is scheduled to run daily at 02:30:45 and the business date is 20251031. The baseline times are:
-
Business date: The value of ${yyyymmdd} is 20251031.
-
Scheduling time: The value of $[yyyymmddhh24miss] is 20251101023045.
Key differences between ${...} and $[...]
The ${...} and $[...] formats differ in their time baselines and calculation capabilities. Mixing them can lead to data errors.
|
Comparison |
|
|
|
Time baseline |
Business date (T-1) |
Scheduling time (T) |
|
Time precision |
Day (year, month, day) |
Second (year, month, day, hour, minute, second) |
|
Supported offsets |
Supports offset calculations for year, month, week, and day. |
Supports offset calculations for day, hour, and minute. |
|
Core limitations |
Does not support formatting or offset calculations for smaller time units such as hours, minutes, or seconds. |
Direct year or month offsets using syntax such as |
|
Equivalent system parameter |
|
|
Time formatting
Use the ${...} or $[...] formats to generate time parameters. Combine format codes such as yyyy, yy, mm, and dd to generate dates that are N years, months, or days before or after the business date.
|
Code |
Description |
|
|
||
|
Example |
Result |
Example |
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 |
|
|
|
|
|
|
Date formatted with hyphens |
|
|
|
|
|
|
Date and time formatted with hyphens and colons |
Not supported (day-level precision) |
- |
This format can be achieved by using string concatenation. See String concatenation: Case 2. |
|
Offset calculation
Offset calculation allows you to add or subtract time from a business date or scheduling time. You can apply offsets of N years, months, days, hours, or minutes relative to the time baseline. Hour and minute offsets are supported only for scheduling time. The offset capabilities of ${...} and $[...] differ because they support different levels of time precision.
-
${...}offset calculation-
Core capability: Supports integer offsets for years, months, weeks, and days.
ImportantOffsets for hours and minutes are not supported. For example, ${yyyy-mm-dd-1/24} is an invalid syntax.
-
Syntax:
${<time_format><±N>}, where the unit of N is the smallest unit in the format, such asyyyymmoryyyymmdd.Requirement
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 previous day:
${yyyymmdd-1}
-
-
$[...]offset calculation-
Core capability: Supports fractional offsets for days, hours, and minutes.
ImportantThe
$[...]format cannot use expressions such as$[yyyy-N]or$[mm-N]to retrieve dates from N years or months ago. To perform year or month offsets, you must use theadd_monthsfunction. -
Syntax:
$[<time_format><±N>], where N represents a fraction of a day: useN/24for an N-hour offset andN/24/60for an N-minute offset.Requirement
Offset unit
Syntax
Example
N years before/after
Year
N years later:
$[add_months(yyyymmdd,12*N)]
N years earlier:$[add_months(yyyymmdd,-12*N)]Get the previous year:
$[add_months(yyyymmdd,-12)]N months before/after
Month
N months later:
$[add_months(yyyymmdd,N)]
N months earlier:$[add_months(yyyymmdd,-N)]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 the previous day (yesterday):
$[yyyymmdd-1]N hours before/after
Hour
Available formats:
-
$[hh24miss±N/24],$[hh24±N/24] -
$[<custom_time_format>±N/24]
Get the previous hour in different formats:
-
Month:
$[mm-1/24] -
Year:
$[yyyy-1/24] -
Year and month:
$[yyyymm-1/24] -
Year, month, and day:
$[yyyymmdd-1/24] -
Previous day and previous hour:
$[yyyymmdd-1-1/24]
N minutes before/after
Minute
Available formats:
-
$[hh24miss±N/24/60] -
$[yyyymmddhh24miss±N/24/60] -
$[mi±N/24/60] -
$[<custom_time_format>±N/24/60]
Get the time 15 minutes before the scheduling time in different formats:
-
$[yyyy-15/24/60] -
$[yyyymm-15/24/60] -
$[yyyymmdd-15/24/60] -
$[hh24-15/24/60] -
$[mi-15/24/60]
Combined offset
Day + Hour
$[yyyymmdd±N±M/24], where N is the day offset and M is the hour offset.Example: Get the time for the previous day and previous hour →
$[yyyymmdd-1-1/24]Note-
Cross-day handling: Hour and minute offsets may result in a time that crosses a day boundary. For details on how to handle this, see How to handle cross-day parameter replacement when offsetting by one hour.
-
Month-end calibration: When you apply a month offset to a month-end date, if the target month has fewer days, the result is automatically calibrated to the last day of that month. For example, subtracting one month from 2025-03-31 returns 2025-02-28 because February does not have 31 days.
-
-
Secondary transformation using engine functions
If built-in formatting and offset capabilities cannot produce the exact value you need (for example, the last day of the previous month), apply a secondary transformation using the node's engine functions or an assignment node.
See: Typical scenarios for secondary processing of scheduling parameter return values.
String concatenation
Use string concatenation to build structured date strings not supported by the built-in syntax. This method combines a date part generated by a scheduling parameter with a constant string.
Case 1: Dynamically get the first day of each month
-
Scenario: You need a string that represents the first day of the current month in
yyyymm01format, regardless of which day the task runs. -
Implementation:
-
Extract the year and month part: 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 extracted year and month with the constant string
'01'. -
Parameter call:
first_day_of_month=${yyyymm}01
-
-
Result: When the task runs,
${first_day_of_month}is replaced with20231001.
Case 2: Generating a timestamp in yyyy-mm-dd hh24:mi:ss format
-
Scenario: You need to generate a timestamp in the
yyyy-mm-dd hh24:mi:ssformat, such as2023-11-01 02:30:45. -
Implementation:
-
Define two parameters,
datetime1anddatetime2. Set them as follows:datetime1=$[yyyy-mm-dd]anddatetime2=$[hh24:mi:ss]. -
Concatenate the
datetime1anddatetime2parameters, separated by a space. -
Parameter call: pt=
${datetime1}${datetime2}
-
-
Result: When the task runs,
${datetime1}${datetime2}is replaced with2023-11-01 02:30:45.
Built-in system parameters
DataWorks provides the following built-in system parameters. Due to their fixed time formats and limited flexibility, custom time parameters are recommended instead.
|
Parameter |
Description |
|
$bizdate |
The business date in Typically defaults to the day before the task's scheduled run time. |
|
$cyctime |
The scheduled time in |
|
$gmtdate |
The current date in Defaults to the current date. For a data backfill, the date is |
|
$bizmonth |
The business month in
|
|
$jobid |
The ID of the workflow that contains the task. |
|
$nodeid |
The ID of the node. |
|
$taskid |
The ID of the instance that the node generates. |
Examples of parameter replacement
The replacement value for a scheduling parameter is determined when an instance is created and is not affected by the actual start time.
Scenario 1: normal scheduling
In normal scheduling, parameter replacement is based on two time baselines: the business date and the scheduling time.
-
${...}(business date): The value is derived from the instance's business date. -
$[...](scheduling time): The value is derived from the instance's scheduling time.
For example, consider a daily task named A scheduled to run at 00:00 with the following parameters:
-
yesterday=${yyyymmdd} -
today=$[yyyymmddhh24miss]
The following table shows how these parameters are replaced for a specific instance:
|
Scheduling time |
Business date |
yesterday=${yyyymmdd} |
today=$[yyyymmddhh24miss] |
|
|
|
|
|
Scenario 2: data backfill
During a data backfill, the parameter replacement logic changes based on the selected business date. This particularly affects parameters that depend on the scheduling time.
-
${...}(business date): The baseline is the manually selected business date. -
$[...](scheduling time): The baseline is the manually selected business date + 1 day.
For example, if you backfill task A with 2025-03-15 as the business date:
|
Selected business date |
yesterday=${yyyymmdd} |
today=$[yyyymmddhh24miss] |
|
|
|
|
FAQ
For questions about scheduling parameters, see Scheduling Parameters FAQ.