3. Elements of SQL Statements : SQL Operations : Arithmetic Operations : Date and Time Arithmetic
 
Share this page                  
Date and Time Arithmetic
The following arithmetic is supported for date and time data types.
Note:  "Absolute type" is a non-interval form.
Operators that return absolute date forms:
absolute type
-
interval type
=
absolute type
absolute type
+
interval type
=
absolute type
interval type
+
absolute type
=
absolute type
The result will be the same as the absolute term.
Operators used with intervals:
- interval type
=
interval type
 
 
+ interval type
=
interval type
 
 
absolute type
-
absolute type
=
interval type
interval type
+
interval type
=
interval type
interval type
-
interval type
=
interval type
interval type
*
numeric-expression
=
interval type
numeric-expression
*
interval type
=
interval type
interval type
/
numeric-expression
=
interval type
interval type
/
interval type
=
numeric-expression
The combining rules are:
ANSI absolute types must match to take their difference.
You cannot combine YEAR TO MONTH and DAY TO SECOND intervals.