HSETPT: Inserting a Component Into a Date-Time Value

How to:

The HSETPT function inserts the numeric value of a specified component into a date-time value.


Top of page

x
Syntax: How to Insert a Component Into a Date-Time Value
HSETPT(timestamp, component, value, length, output_format)

where:

timestamp

Date-Time

Is the timestamp into which a component value is to be inserted.

component

Alphanumeric

Is the name of the component to be incremented.

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

value

Integer

Is the numeric value to be inserted for the requested component.

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.

output_format

Date-Time

Is the timestamp whose chosen component is updated. All other components are copied from the timestamp.



Example: Inserting a Component Into a Date-Time Value

Assuming that the current date and time obtained by HGETC in the first parameter are 03/31/2004 and 13:34:36, this example,

UHOUR/HMDYYS = HSETPT(HGETC(8,'HYYMDS'),'HOUR', 7, 8, UHOUR);  

returns 03/31/2004 07:34:36.


iWay Software