HGETC: Storing the Current Date and Time in a Date-Time Field

How to:

Available Languages: reporting, Maintain

The HGETC function stores the current date and time in a date-time field. If millisecond, microsecond, or nanosecond values are not available in your operating environment, the function retrieves the value zero for these components.


Top of page

x
Syntax: How to Store the Current Date and Time in a Date-Time Field
HGETC(length, outfield)

where:

length

Integer

Is the length of the returned date-time value. Valid values are:

8 indicates a time value that includes milliseconds.

10 indicates a time value that includes microseconds.

12 indicates a time value that includes nanoseconds.

outfield

Date-time

Is the field that contains the result, or the format of the output value enclosed in single quotation marks. The format must be in date-time format (data type H).



Example: Storing the Current Date and Time in a Date-Time Field (Reporting)

HGETC stores the current date and time in DT2:

TABLE FILE VIDEOTR2
PRINT CUSTID TRANSDATE AS 'DATE-TIME' AND COMPUTE
DT2/HYYMDm = HGETC(10, 'HYYMDm');
WHERE DATE EQ 2000;
END

The output is:

CUSTID  DATE-TIME         DT2
------  ---------         ---
1237    2000/02/05 03:30  2000/10/03 15:34:24.000000
1118    2000/06/26 05:45  2000/10/03 15:34:24.000000


Example: Storing the Current Date and Time in a Date-Time Field (Maintain)

HGETC stores the current date and time in DT2:

MAINTAIN
COMPUTE DT2/HYYMDm = HGETC(10, DT2);
TYPE "DT2 = <DT2";
END

WebFOCUS