Previous Topic Next topic Print topic


Labeled Duration

The following table contains keywords known as labeled durations. Each labeled duration keyword corresponds to a specific time unit, interpreted as it normally would be against a calendar or clock. A labeled duration can only be used in an arithmetic expression having date, time or timestamp expressions (or columns) as one of the operands. The expression must resolve to the proper data type. For example, DATE("1993-12-12") + DAY is a valid expression, as is BIRTHDATE + 15 YEARS + 8 MONTHS.

The expression BIRTHDATE + (15 YEARS + 8 MONTHS), on the other hand, cannot be resolved because the system would attempt to add the expression in parentheses first, which contains no date or time operand.

A labeled duration is converted into a decimal (15,0) number before it is applied. If present, decimal places are truncated. All of the keywords listed in the following table can also be used in singular form as labeled durations (for example, YEAR is the same as YEARS, MONTH is the same as MONTHS, etc.)

Duration Example
YEARS goldenanniv = weddingdate + 50 years
MONTHS eligibledate = hiredate + 6 months
DAYS nextcall = current date + 14 days
HOURS endshift = beginshift + 8 hours
MINUTES sampletime = current time + 10 minutes
SECONDS eta = depart + second(travel) seconds
MICROSECONDS adjustedtime=recordedtime - 200 microseconds
Previous Topic Next topic Print topic