How to: |
The HADD function increments a date-time value by a given number of units.
HADD(datetime, 'component', increment, length, output)
where:
Date-time
Is the date-time value to be incremented.
Alphanumeric
Is the name of the component to be incremented enclosed in single quotation marks. For a list of valid components, see Arguments for Use With Date and Time Functions.
Note: WEEKDAY is not a valid component for HADD.
Integer
Is the number of units (positive or negative) by which to increment the component.
Integer
Is the number of characters returned. Valid values are:
8 indicates a date-time value that includes one to three decimal digits (milliseconds).
10 indicates a date-time value that includes four to six decimal digits (microseconds).
12 indicates a date-time value that includes seven to nine decimal digits (nanoseconds).
Date-time
The following example increments thirty months to some specific date-time in the past
HADD(DT(2001/09/11 08:54:34), 'MONTH', 30, 8, 'HYYMDS')
and returns the timestamp 2004/03/11 08:54:34.00.
iWay Software |