DT_CURRENT_DATETIME: Returning the Current Date and Time

How to:

DT_CURRENT_DATETIME returns the current date and time provided by the running operating environment in date-time format, with a specified time precision.

Syntax: How to Return the Current Date and Time

DT_CURRENT_DATETIME(component)

where:

component

Is one of the following time precisions.

  • SECOND.
  • MILLISECOND.
  • MICROSECOND.

Note: The field to which the value is returned must have a format that supports the time precision requested.

Example: Returning the Current Date and Time

The following request returns the current date and time, with the time specified in microseconds.

DEFINE FILE WF_RETAIL_LITE
CURRDATE/HYYMDm WITH COUNTRY_NAME = DT_CURRENT_DATETIME(MICROSECOND);
END
TABLE FILE WF_RETAIL_LITE
SUM CURRDATE
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.