HMIDNT: Setting the Time Portion of a Timestamp to Midnight

How to:

The HMIDNT function changes the time portion of a timestamp in date-time format to midnight (all zeroes by default). This allows you to compare a date field with a timestamp in date-time format.


Top of page

x
Syntax: How to Set the Time Portion of a Timestamp to Midnight
HMIDNT(timestamp, length, output_format)

where:

timestamp

Date-Time

Is the timestamp whose time is to be set to midnight.

length

Integer

Is the number of characters returned as the timestamp. Valid values are:

8 for a timestamp in date-time format that includes milliseconds.
10 for a timestamp in date-time format that includes microseconds.

output_format

Date-Time

Is the timestamp 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