HHMMSS: Retrieving the Current Time

Available Languages: reporting

The HHMMSS function retrieves the current time from the operating system as an eight character string, separating the hours, minutes, and seconds with periods.

A compiled MODIFY procedure must use HHMMSS to obtain the time; it cannot use the &TOD variable, which also returns the time. The &TOD variable is made current only when you execute a MODIFY, SCAN, or FSCAN procedure.

There is also an HHMMSS function available in the Maintain language. For information on this function, see Maintain-specific Standard Date and Time Functions.

Retrieve the Current Time

HHMMSS(output)

where:

output

Alphanumeric, at least A8

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

Retrieving the Current Time

This example,

HMMSS('A10')

creates a character string representing the current time, like 12.09.47. Note that a shorter output_format format will cause truncation of output.

Retrieving the Current Time

HHMMSS retrieves the current time and displays it in the page footing:

TABLE FILE EMPLOYEE
SUM CURR_SAL AS 'TOTAL SALARIES' AND COMPUTE
NOWTIME/A8 = HHMMSS(NOWTIME); NOPRINT
BY DEPARTMENT
FOOTING
"SALARY REPORT RUN AT TIME <NOWTIME"
END

The output is:

DEPARTMENT   TOTAL SALARIES
----------   --------------
MIS             $108,002.00
PRODUCTION      $114,282.00
 
SALARY REPORT RUN AT TIME 15.21.14