HINPUT: Converting an Alphanumeric String to a Timestamp

How to:

The HINPUT function converts an alphanumeric string to a timestamp in date-time format.


Top of page

x
Syntax: How to Convert an Alphanumeric String to a Timestamp
HINPUT(source_length, source_string, timestamp_length, output_format)

where:

source_length

Integer

Is the number of characters in the source_string.

source_string

Alphanumeric

Is the string to be converted. The string can consist of any valid date-time input value, as described in Date and Time Components For Date and Date-Time Functions.

timestamp_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 newly created timestamp.



Example: Converting an Alphanumeric String to a Timestamp

This example,

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

converts the character string (20040229 13:34:00) into a timestamp, which is then assigned to the date-time field DTM. DTM is displayed as 2004/02/29 13:34:00.


iWay Software