HTIME: Converting the Time Portion of a Date-Time Value to a Number

How to:

The HTIME function converts the time portion of a timestamp in date-time format to the number of milliseconds if the first argument is 8, or microseconds if the first argument is 10. To include microseconds, the input timestamp format must be a 10-byte date-time format.


Top of page

x
Syntax: How to Convert the Time Portion of a Date-Time Value to a Number
HTIME(length, timestamp, output_format)

where:

length

Integer

Is the number of characters returned as a 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.

timestamp

Date-Time

Is the timestamp from which to convert the time.

output_format

Is floating-point double precision format.



Example: Converting the Time Portion of a Date-Time Value to a Number

Assuming that the current date and time obtained by HGETC in the second parameter are 03/31/2004 and 13:48:14, this example returns and assigns to NMILLI, 49,694,395. (Note that this example uses milliseconds rather than microseconds.)

NMILLI/D12.0 = HTIME(8, HGETC(10,'HYYMDS'), NMICRO);   

Assuming that the first parameter is equal to 10 and the timestamp format is HYYMDSS, this example returns and assigns to NMICRO, 50,686,123,024.

NMICRO/D12.0 = HTIME(10, HGETC(10,'HYYMDSS'), NMICRO); 

iWay Software