HMIDNT: Setting the Time Portion of a Date-Time Value to Midnight

How to:

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.


Top of page

x
Syntax: How to Set the Time Portion of a Date-Time Value to Midnight
HMIDNT(datetime, length, output)

where:

datetime

Date-time

Is the date-time value whose time is to be set to midnight.

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.

output

Date-time

Is the date-time return value whose time is set to midnight and whose date is copied from timestamp.



Example: Setting the Time Portion of a Timestamp to Midnight

This example converts the character string (20040229 13:34:00) to a timestamp, which is assigned to DTM:

DTM/HYYMDS = HINPUT(14, '20040229 13:34:00', 8, DTM);

This example resets the time portion of DTM to midnight and assigned the timestamp (02/29/2004 00:00:00) to DTMIDNT:

DTMIDNT/HMDYYS = HMIDNT(DTM, 8, DTMIDNT);

iWay Software