SAND CDBMS SQL Reference Guide
Date/Time Arithmetic


Previous Topic:
Chapter Index
Next Topic:
Intervals and Date/Time Values


Labeled Durations (Casting Expressions to Interval Types)

Expressions can be cast into an interval type by labeling the expression as a duration. This labeled duration is represented by a numeric expression followed by one of the duration keywords. The supported labeled durations are DAY(S), MONTH(S), YEAR(S), HOUR(S), MINUTE(S), SECOND(S), and MICROSECOND(S). The possible labeled durations and resulting interval types are summarized in the following table:

Label Result Type
<integer expression> DAYS (or DAY) date interval
<integer expression> MONTHS (or MONTH) date interval
<integer expression> YEARS (or YEAR) date interval
<integer expression> HOURS (or HOUR) time interval
<integer expression> MINUTES (or MINUTE) time interval
<integer expression> SECONDS (or SECOND) time interval
<decimal/float expression> SECONDS (or SECOND) timestamp interval
<numeric expression> MICROSECONDS (or MICROSECOND) timestamp interval


277 DAYS

(1024*1024-100) MINUTES