UNITS

The UNITS operator returns an INTERVAL value, based on a single time unit.

4GLREF00000106.gif

keyword is one of the following keywords to specify a time unit:

YEAR MONTH DAY
HOUR MINUTE SECOND FRACTION(n)

Here n is an integer, greater than zero but less than 6, to specify the scale of the SECOND specification.

The UNITS operator returns an INTERVAL value for a single unit of time, such as DAY TO DAY, YEAR TO YEAR, or HOUR TO HOUR. If you substitute a number expression for the integer operand, any fractional part of the returned value is discarded before the UNITS operator is applied.

The UNITS operator has a higher precedence than any arithmetic or Boolean operator. You may need parentheses around its operand, if this is an expression that includes other operators. Any left-hand arithmetic operand that includes the UNITS operator must be enclosed within parentheses.

References

Arithmetic Operators