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

How to:

The HTIME function converts the time portion of a date-time value to the number of milliseconds if the length argument is eight, microseconds if the length argument is ten, or nanoseconds if the length argument is 12.

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

HTIME(length, datetime, output)

where:

length

Integer

Is the length of the input date-time value. Valid values are:

  • 8 indicates a time value that includes one to three decimal digits (milliseconds).
  • 10 indicates a time value that includes four to six decimal digits (microseconds).
  • 12 indicates a time value that includes seven to nine decimal digits (nanoseconds).
datetime

Date-time

Is the date-time value from which to convert the time.

output

Floating-point double-precision

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); 

WebFOCUS

Feedback