DT_CURRENT_TIME: Returning the Current Time

How to:

The DT_CURRENT_TIME function returns the current time provided by the running operating environment in date-time format, with a specified time precision. The date portion of the returned date-time value is set to zero.

Syntax: How to Return the Current Time

DT_CURRENT_TIME(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 Time

The following request returns the current time, with the time precision set to milliseconds.

DEFINE FILE WF_RETAIL_LITE
CURRTIME/HHISs WITH COUNTRY_NAME = DT_CURRENT_TIME(MILLISECOND);
END
TABLE FILE WF_RETAIL_LITE
SUM CURRTIME
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.