How to: |
Available Languages: reporting, Maintain
The HMIDNT function changes the time portion of a date-time value to midnight (all zeros by default). This allows you to compare a date field with a date-time field.
HMIDNT(datetime, length, output)
where:
Date-time
Is the date-time value whose time is to be set to midnight, the name of a date-time field that contains the value, or an expression that returns the value.
Integer
Is the length of the returned date-time value. Valid values are:
Date-time
Is the date-time return value whose time is set to midnight and whose date is copied from timestamp. 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).
HMIDNT sets the time portion of the TRANSDATE field to midnight first in the 24-hour system and then in the 12-hour system:
TABLE FILE VIDEOTR2 PRINT CUSTID TRANSDATE AS 'DATE-TIME' AND COMPUTE TRANSDATE_MID_24/HYYMDS = HMIDNT(TRANSDATE, 8, 'HYYMDS'); TRANSDATE_MID_12/HYYMDSA = HMIDNT(TRANSDATE, 8, 'HYYMDSA'); WHERE DATE EQ 2000; END
The output is:
CUSTID DATE-TIME TRANSDATE_MID_24 TRANSDATE_MID_12 ------ --------- ---------------- ---------------- 1118 2000/06/26 05:45 2000/06/26 00:00:00 2000/06/26 12:00:00AM 1237 2000/02/05 03:30 2000/02/05 00:00:00 2000/02/05 12:00:00AM
HMIDNT sets the time portion of DT1 to midnight in both the 24-hour and 12-hour systems:
MAINTAIN FILE DATETIME FOR 1 NEXT ID INTO STK; COMPUTE DT_MID_24/HYYMDS = HMIDNT(STK(1).DT1, 8, DT_MID_24); DT_MID_12/HYYMDSA= HMIDNT(STK(1).DT1, 8, DT_MID_12); TYPE "STK(1).DT1 = "STK(1).DT1; TYPE "DT_MID_24 = <DT_MID_24"; TYPE "DT_MID_12 = <DT_MID_12"; END