Using QMF

Using durations to represent date/time intervals

A duration is a number that represents an interval of time. The number can be a constant, a column name, a function, or an expression.

A duration represents any number of years, months, days, hours, minutes, seconds, or microseconds. The unit is expressed by a keyword that follows the number. In the expression STARTD+25 YEARS, the duration is 25 YEARS.

You can use a duration only in an expression that involves a date or time value. For example, STARTD+25 YEARS+1 MONTH is a valid expression. (STARTD is a column in Q.PROJECT that gives the start date of a project.) STARTD+(25 YEARS+1 MONTH) is not a valid expression, because (25 YEARS+1 MONTH) does not include a date or time value within the parentheses.

YEAR(ENDD - STARTD) < 3 YEARS is not valid because you cannot use the duration, 3 YEARS, as an operand of comparison. A valid way of coding this is YEAR(ENDD - STARTD) < 3.

Subtracting one date from another date results in a duration that is expressed by the number of years, months, and days. Subtracting one time from another time results in a duration that is expressed in the number of hours, minutes, and seconds. See Subtracting dates and Subtracting times for the exact format of these results.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]