HNAME: Retrieving a Date-Time Component in Alphanumeric Format

How to:

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


Top of page

x
Syntax: How to Retrieve a Date-Time Component in Alphanumeric Format
HNAME(datetime, 'component', output)

where:

datetime

Date-time

Is the date-time value from which a component value is to be extracted.

component

Alphanumeric

Is the name of the component to be retrieved enclosed in single quotation marks. For a list of valid components, see Arguments for Use With Date and Time Functions.

output

Alphanumeric, at least A2

The function converts all other components to strings of digits only. 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);  


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