This page is the complete syntax reference for task parameters, covering system built-in parameters, time expressions, and built-in time functions in detail.
⚠️ Note: The parameter feature is currently in limited rollout and is only available to select users. See the verification method in Task Parameters.
System Built-in Parameters
The system provides a set of commonly used parameters that you can use directly for parameter assignment — no manual calculation needed.
⚠️ Built-in parameters cannot be referenced directly in code. You must first assign them to a custom parameter in the parameter configuration, then reference the custom parameter in your code.
Date and Time Parameters
Parameter name
Format
Description
Example (reference time: 2023-09-22 18:00:00)
bizdate
yyyyMMdd
Business date (scheduled time minus 1 day)
20230921
sys_biz_day
yyyy-MM-dd
Business date
2023-09-21
sys_biz_datetime
yyyy-MM-dd HH:mm:ss
Business datetime
2023-09-21 18:00:00
sys_plan_day
yyyy-MM-dd
Scheduled date
2023-09-22
sys_plan_datetime
yyyy-MM-dd HH:mm:ss
Scheduled datetime
2023-09-22 18:00:00
sys_plan_timestamp
13-digit timestamp
Scheduled timestamp (milliseconds)
1695463200000
Task Information Parameters
Parameter name
Description
Example
Notes
sys_task_id
Task ID
1002
Scheduled run only
sys_task_name
Task name
demo_task
Scheduled run only
sys_task_owner
Task owner
UAT_TEST
Scheduled run only
Usage Examples
-- Filter partitions by business date
SELECT * FROM table WHERE dt = '${dt}';
-- Parameter config: dt = sys_biz_day
-- Scheduled time 2023-09-22, actual execution: WHERE dt = '2023-09-21'
-- Use the scheduled timestamp
SELECT * FROM table WHERE create_time >= ${start_ts};
-- Parameter config: start_ts = sys_plan_timestamp
-- Result: WHERE create_time >= 1695463200000
Usage Recommendations
Business date scenarios: prefer bizdate or sys_biz_day
When hours, minutes, and seconds are needed: use sys_biz_datetime or sys_plan_datetime
Timestamp calculations: use sys_plan_timestamp
Audit logging: use the sys_task_* parameters to record task information
Time Expressions
Time expressions support flexible time formatting and offset calculations and are the core feature of the parameter system.
Basic Syntax
$[time_format] # Basic formatting
$[time_format, offset] # With offset
$[time_format, offset1, offset2, ...] # Multiple offsets (applied in sequence)
Time Format Elements
Time expressions follow the ISO-8601 standard and are strictly case-sensitive.
Element
Meaning
Example
yyyy
Four-digit year
2023
yy
Two-digit year
23
MM
Two-digit month (01-12)
09
dd
Two-digit day (01-31)
22
HH
24-hour hour (00-23)
18
mm
Minute (00-59)
59
ss
Second (00-59)
49
.SSS
Millisecond
0.377
ZZ
Time zone
+08:00
⚠️ Common mistakes: YYYY (uppercase Y is not supported), yyyy-mm-dd (lowercase m is minute, not month), hh (lowercase h is 12-hour format). Correct form: yyyy-MM-dd HH:mm:ss.
$[yyyy-MM-dd, -1d] → Yesterday
$[yyyy-MM-dd, 1d] → Tomorrow
$[yyyy-MM-dd, -1mon] → Same day last month
$[yyyy-MM-dd, -1y] → Same day last year
$[HH:mm:ss, -1h] → 1 hour ago
-- Multiple offsets (applied in sequence)
$[yyyy-MM-dd, -1y, -1mon, -1d] → Last year, last month, yesterday
$[yyyyMMdd, 1mon, -7d] → Next month minus 7 days
Built-in Time Functions
These handle calculation scenarios that time expressions cannot express directly, such as "first day of this month" or "last Sunday."
Month Functions
first_day_of_month() — First day of the current month
first_day_of_month() # Default format yyyy-MM-dd
first_day_of_month(format) # Specify format
first_day_of_month(format, duration) # With offset
-- First day of the current month
month_start = first_day_of_month() → 2023-09-01
-- First day of last month
last_month_start = first_day_of_month('yyyy-MM-dd', '-1mon') → 2023-08-01
-- Custom format
month_start = first_day_of_month('yyyyMMdd') → 20230901
last_day_of_month() — Last day of the current month
last_day_of_month() # Default format yyyy-MM-dd
last_day_of_month(format) # Specify format
last_day_of_month(format, duration) # With offset
-- Last day of the current month
month_end = last_day_of_month() → 2023-09-30
-- Last day of last month
last_month_end = last_day_of_month('yyyy-MM-dd', '-1mon') → 2023-08-31
Week Functions
Monday is the first day of the week and Sunday is the last day.
first_day_of_week() — First day of the current week (Monday)
first_day_of_week() # Default format yyyy-MM-dd
first_day_of_week(format) # Specify format
first_day_of_week(format, duration) # With offset
-- This Monday (assuming current date is 2023-09-22, Friday)
week_start = first_day_of_week() → 2023-09-18
-- Last Monday
last_week_start = first_day_of_week('yyyy-MM-dd', '-1w') → 2023-09-11
last_day_of_week() — Last day of the current week (Sunday)
last_day_of_week() # Default format yyyy-MM-dd
last_day_of_week(format) # Specify format
last_day_of_week(format, duration) # With offset
-- This Sunday
week_end = last_day_of_week() → 2023-09-24
-- Last Sunday
last_week_end = last_day_of_week('yyyy-MM-dd', '-1w') → 2023-09-17
day_of_week() — Returns the day of the week
day_of_week() # Today's day of the week (returns 1-7, 1=Monday, 7=Sunday)
day_of_week(duration) # Day of the week after offset
get_day_of_week() — Get the date of a specific day of the week
get_day_of_week(format, whichDay) # That day of the current week (1=Monday, 7=Sunday)
get_day_of_week(format, whichDay, duration) # That day of the offset week
-- This Tuesday (assuming current date is 2023-09-22, Friday)
this_tuesday = get_day_of_week('yyyy-MM-dd', 2) → 2023-09-19
-- Last Wednesday
last_wednesday = get_day_of_week('yyyy-MM-dd', 3, '-1w') → 2023-09-13
-- Next Friday
next_friday = get_day_of_week('yyyy-MM-dd', 5, '1w') → 2023-09-29
week_of_month() — Week number within the current month
week_of_month() # Which week of the month today falls in (returns integer)
week_of_month(duration) # Which week of the month after offset
week_of_year() — Week number within the current year
week_of_year() # Which week of the year today falls in (returns integer)
week_of_year(duration) # Which week of the year after offset
Timestamp Functions
timestamp() — Millisecond timestamp
timestamp() # Millisecond timestamp of the current scheduled time (13 digits)
timestamp(offset1, offset2, ...) # With offsets