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(datetime, 'component', value, length, output)

where:

datetime

Date-time

Is the date-time value in which to insert the component.

component

Alphanumeric

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

value

Integer

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

length

Integer

Is the length of the returned 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).

output

Date-time

Is the returned date-time value whose chosen component is updated. All other components are copied from the source date-time value.



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