HDATE: Converting the Date Portion of a Date-Time Value to a Date Format

How to:

The HDATE function converts the date portion of a date-time value to the date format YYMD. You can then convert the result to other date formats.

Syntax: How to Convert the Date Portion of a Date-Time Value to a Date Format

HDATE(datetime, output)

where:

datetime

Date-time

Is the date-time value to be converted, the name of a date-time field that contains the value, or an expression that returns the value.

output

Date

Is the format in single quotation marks or the field that contains the result.

Example: Converting the Date Portion of a Date-Time Field to a Date Format (Reporting)

HDATE converts the date portion of the TRANSDATE field to the date format YYMD:

TABLE FILE VIDEOTR2
PRINT CUSTID TRANSDATE AS 'DATE-TIME' AND COMPUTE
TRANSDATE_DATE/YYMD = HDATE(TRANSDATE, 'YYMD');
WHERE DATE EQ 2000;
END

The output is:

CUSTID  DATE-TIME         TRANSDATE_DATE
------  ---------         --------------
1237    2000/02/05 03:30  2000/02/05
1118    2000/06/26 05:45  2000/06/26