Current date—%CURDATE

Use this function when you want CDC Replication to return the current date during data replication (refresh or mirroring) activities on the source or target.

For example, you may want to track when CDC Replication inserts a record or when it performs updates on source and target columns. This function uses the system clock you have set on the source or target.
Note: The CDC Replication Engine for Db2® for i does not support this function.

Mapping a target column to an expression that uses the %CURDATE function is not the same as defining the current date as the initial value for the target column. When you map a target column to an expression, CDC Replication populates the target column with the current date when a record is inserted or updated in the target table. However, when you define the initial value as the current date, CDC Replication populates the target column with the current date only when it inserts a record into the target table.

Syntax

%CURDATE(timezone)

Parameters

timezone
Specifies the time zone of the result. You must enclose values of this parameter in double or single quotation marks.
*LOC
Returns the date local to the source or target.
*UTC
Returns the date in Coordinated Universal Time (UTC).
*GMT
Returns the date in Greenwich Mean Time (GMT).
This is the same as *UTC.

Result data type

Character string in the format CCYY-MM-DD.

If you want you want to convert the character string to a date format, a sample is provided in the Examples section.

Examples

%CURDATE(*LOC)

If the local time is March 11, 2004, this function returns 2004-03-11.

%CURDATE(*UTC)

For a server located in the Japan Standard Time (JST) zone, on August 28, 2007, at 1:21 AM, this function returns 2007- 08-27. JST is 9 hours ahead of UTC (UTC+9).

%CURDATE(*GMT)

For a server located in the Japan Standard Time (JST) zone, on August 28, 2007, at 1:21 AM, this function returns 2007- 08-27. JST is 9 hours ahead of UTC (UTC+9). This example is equivalent to %CURDATE (*UTC).

%SUBSTRING(%CURDATE(*LOC), 6, 5)

Returns the month and day of the %CURDATE function invocation local to the source or target. You can use this example if you require the month and day only. For example, if the local date is January 29, 2007, the expression returns 01-29.

%TODATE(%CURDATE(*LOC), *YYMD)

Returns the character data of the %CURDATE function invocation in a YYMD date format.