CVTSTIME: Converting the System Date and Time (OpenVMS Only)

How to:

The CVTSTIME function converts the retrieved 64-bit DEC Date/Time formatted field to a printable character string or internal natural date value offset. CVSTIME is generally used with GETSTIME which actually extracts a 64-bit DEC Date/Time from the system.


Top of page

x
Syntax: How to Convert the System Date and Time
CVTSTIME(formatstyle, infield, output)

where:

formatstyle

Integer

Is a number from 0 to 5, from the list below, that corresponds to a formatting style for the output.

0 returns DD-MMM-YYYY HH:MM:SS

1 returns DD-MMM-YYYY

2 returns HH:MM:SS

3 returns DD-MMM-YYYY HH:MM:SS.CC

4 returns YYYY-MM-DD HH:MM:SS.CC

5 indicates a FOCUS natural date format offset, that is, an integer indicating the number of elapsed days from December 31, 1900.

infield

Alphanumeric

Is the field containing the incoming 64-bit DEC Date/Time formatted string to be converted.

output

Alphanumeric, or D4 (or higher) for Format Style 5 (see the table below).

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

Note: Output must specify enough space to accommodate the string size specified by the formatstyle parameter.

Formatting Style Number

Number of Bytes

0

20

1

11

2

8

3

23

4

22

5

4



Example: Converting the System Date and Time

This request displays employee department assignments and salaries with a heading that includes the current date.

DEFINE FILE EMPLOYEE
SYSTEM_DATE/A8 = GETSTIME('A8') ;
ELAPSED/D8 = CVTSTIME(5,SYSTEM_DATE,'D8') ;
BASE/MDY = '12/31/00' 
THE_DATE/MDY = BASE + ELAPSED ;
END
TABLE FILE EMPLOYEE
HEADING
"SALARY REPORT RUN ON DATE: <THE_DATE"
PRINT DEPARTMENT CURR_SAL
BY LAST_NAME BY FIRST_NAME
END

WebFOCUS