HNAME: Retrieving a Timestamp Date or Time Component as Alphanumeric Value

How to:

The HNAME function extracts a specified component value from a timestamp, in date-time format, and returns it as digits, in alphanumeric format.


Top of page

x
Syntax: How to Retrieve a Timestamp Date or Time Component as Alphanumeric Value
HNAME(timestamp, component, output_format)

where:

timestamp

Date-Time

Is the timestamp from which a component value is to be extracted.

component

Alphanumeric

Is the name of the component to be extracted.

For a list of valid components, see Date and Time Components For Date and Date-Time Functions.

output_format

Alphanumeric, at least A2

The function converts a component value to a string of digits. The year is always four digits, and the hour assumes the 24-hour system.



Example: Retrieving a Timestamp Date or Time Component as an Alphanumeric Value

Assuming that the current time obtained by the function HGETC in the first parameter is 13:22:11, this example returns the string '13' and assigns it to AHOUR:

AHOUR/A2 = HNAME(HGETC(8,'HYYMDS'),'HOUR', AHOUR);  

iWay Software