OceanBase Database supports date and time operators, which are equivalent to specific date and time functions.
The following table describes the date and time operators supported by OceanBase Database.
| Operator | Operand | Description |
|---|---|---|
+ |
Binary | Adds the date and time values. It is equivalent to the DATE_ADD function. For more information, see DATE_ADD. |
- |
Binary | Performs a subtraction between the date and time values. It is equivalent to the DATE_SUB function. For more information, see DATE_SUB. |
Example:
obclient> SELECT '2008-12-31 23:59:59' + INTERVAL 1 SECOND;
+-------------------------------------------+
'2008-12-31 23:59:59' + INTERVAL 1 SECOND
+-------------------------------------------+
2009-01-01 00:00:00
+-------------------------------------------+
1 row in set (0.01 sec)