SAND CDBMS SQL Reference Guide
Date/Time Arithmetic


Basic arithmetic operations can be performed with DATE, TIME, and TIMESTAMP values. Subtracting one date/time value from another produces an interval. An interval can also be produced by labeling an expression as a duration (a labeled duration). These intervals can be added to or subtracted from the date/time data types and other intervals, and can also be multiplied or divided by numeric expressions. Further, intervals of the same type can be grouped together using a subset of the aggregate functions, or compared in Boolean value expressions using comparison operators. There is implicit type casting when quoted string literals or numeric expressions are involved in date/time arithmetic or Boolean expressions.