Custom parameters are classified into built-in parameters, custom parameters ${...}, custom parameters $[...], and constants. Values are assigned to each type of parameter in the specified formats. This topic compares the value formats of different types of custom parameters.

How different custom parameters are used

For example, the current date is November 1, 2021, and a node is scheduled to run at 00:00 every day. The following table describes how different customer parameters are assigned values.
Note In this example, the parameters are referenced in the pt=${datetime} format in the code.
Parameter Description Assignment Replacement result
${yyyymmdd} Obtains the data timestamp of the node. datetime=${yyyymmdd} datetime=20211031
$[yyyymmddhh24miss] Obtains the time when the node is scheduled to run, which is accurate to seconds. datetime=$[yyyymmddhh24miss] datetime=202111010000
$bizdate Obtains the data timestamp of the node. datetime=$bizdate datetime=20211031
$cyctime Obtains the time when the node is scheduled to run, which is accurate to seconds. datetime=$bizdate datetime=20211101000000
$gmtdate Obtains the current date, which is accurate to days. datetime=$gmtdate datetime=20211101
$bizmonth Obtains the month indicated by the data timestamp of the node. datetime=$bizmonth
  • If the month indicated by the data timestamp is the current month, the value of the $bizmonth parameter is the previous month.
  • If the month indicated by the data timestamp is not the current month, the value of the $bizmonth parameter is the month indicated by the data timestamp.
For example, the current date is November 1, 2021:
  • If the date indicated by the data timestamp is November 2, 2021, which is in the current month, the value of datetime is 202110.
  • If the date indicated by the data timestamp is October 31, 2021, which is not in the current month, the value of datetime is 202110.

Differences between ${...} and $[...] parameters

The following table describes the differences between the ${...} and $[...] parameters.
Item ${...} parameter $[...] parameter
Benchmark The value of the $bizdate parameter is used as a benchmark to run nodes.

The $bizdate parameter indicates the data timestamp. By default, the date indicated by the data timestamp is one day earlier than the current date.

The value of the $cyctime parameter is used as a benchmark to run nodes.

The $cyctime parameter indicates the time when a node is scheduled to run. For example, the value yyyy-mm-dd 00:30:00 indicates 00:30 on the current day.

Data backfill The parameter is replaced with the selected data timestamp. During data backfill, the parameter is replaced with the date that is one day after the date indicated by the selected data timestamp.

For example, 20220315 is the date indicated by the selected data timestamp for data backfill. In this case, the date indicated by the value of the $cyctime parameter is 20220316.

Time granularity The value is accurate to days. The value is accurate to seconds.
Note ${yyyy-mm-dd-1/24} is not supported. We recommend that you use $[yyyy-mm-dd-1-1/24].
In this example, an ODPS SQL node is used, and the current time is 10:30:00 on July 20, 2021. The following table describes how to obtain the required time data by using the ${...} and $[...] parameters.
Time to obtain ${...} parameter $[...] parameter
Year: 2021
  • Assignment: datetime=${yyyy}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy}=2021
  • Assignment: datetime=$[yyyy]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[yyyy]=2021
Year: 21
  • Assignment: datetime=${yy}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yy}=21
  • Assignment: datetime=$[yy]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[yy]=21
Year: 2020
  • Assignment: datetime=${yyyy-1}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-1}=2020
Not supported
Month: 07
  • Assignment: datetime=${mm}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${mm}=07
  • Assignment: datetime=$[mm]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[mm]=07
Day: 20
  • Assignment: datetime=${dd}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${dd}=20
  • Assignment: datetime=$[dd]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[dd]=20
Date: 2021-06-20
  • Assignment: datetime=${yyyy-mm-dd-29}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-mm-dd-29}=2021-06-20
  • Assignment: datetime=$[add_months(yyyymmdd,-1)]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[add_months(yyyymmdd,-1)]=2021-06-20
Date: 2021-07-19
  • Assignment: datetime=${yyyy-mm-dd}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-mm-dd}=2021-07-19
  • Assignment: datetime=$[yyyy-mm-dd-1]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[yyyy-mm-dd-1]=2021-07-19
Date: 2020-07-20
  • Assignment: datetime=${yyyy-mm-dd-364}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-mm-dd}=2020-07-20
  • Assignment: datetime=$[add_months(yyyymmdd,-12*1)]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[add_months(yyyymmdd,-12*1)]=2020-07-20
Time: 10:30:00 Not supported
  • Assignment: datetime=$[hh24:mi:ss]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[hh24:mi:ss]=10:30:00
Time: 2021-07-20 10:30:00 Not supported
  • Assignment: datetime1=$[yyyy-mm-dd] datetime2=$[hh24:mi:ss]
    Note You must customize two variables datetime1 and datetime2, and separate the key-value pairs of the variables with a space.
  • Reference in code: pt=${datetime1} ${datetime2}
  • Replacement result:
    • datetime1=$[yyyy-mm-dd]=2021-07-20
    • datetime2=$[hh24:mi:ss]=10:30:00
    • pt=2021-07-20 10:30:00
Time: 2021-07-20 10:29:00 Not supported
  • Assignment: datetime1=$[yyyy-mm-dd] datetime2=$[hh24:mi:ss-1/24/60]
    Note You must customize two variables datetime1 and datetime2, and separate the key-value pairs of the variables with a space.
  • Reference in code: pt=${datetime1} ${datetime2}
  • Replacement result:
    • datetime1=$[yyyy-mm-dd]=2021-07-20
    • datetime2=$[hh24:mi:ss-1/24/60]=10:29:00
    • pt=2021-07-20 10:29:00
Time: 2021-07-20 09:30:00 Not supported
  • Assignment: datetime1=$[yyyy-mm-dd] datetime2=$[hh24:mi:ss-1/24]
    Note You must customize two variables datetime1 and datetime2, and separate the key-value pairs of the variables with a space.
  • Reference in code: pt=${datetime1} ${datetime2}
  • Replacement result:
    • datetime1=$[yyyy-mm-dd]=2021-07-20
    • datetime2=$[hh24:mi:ss-1/24]=09:30:00
    • pt=2021-07-20 09:30:00