Date and time operators

2024-03-05 01:54:26  Updated

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.

Here is an 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

Contact Us