OceanBase AI Database supports the following date and time data types for representing time values: DATE, TIME, DATETIME, TIMESTAMP, and YEAR. Each type has a valid value range and a "zero" value that indicates an invalid value that cannot be represented.
The following table describes the date and time types supported by the current version of OceanBase AI Database and their related information.
Type |
Format |
Lower Bound |
upper bound |
Meaning |
|---|---|---|---|---|
DATETIME |
YYYY-MM-DD HH:MM:SS[.fraction] | 0000-00-00 00:00:00.000000 | 9999-12-31 23:59:59.999999 | Date and Time (without Time Zone) |
TIMESTAMP |
YYYY-MM-DD HH:MM:SS[.fraction] | 0000-00-00 00:00:00.000000 | 9999-12-31 23:59:59.999999 | Date and Time (with Time Zone) |
DATE |
YYYY-MM-DD | 0000-00-00 | 9999-12-31 | Date |
TIME |
HH:MM:SS[.fraction] | -838:59:59.000000 | 838:59:59.000000 | Time |
YEAR |
YYYY | 1901 | 2155 | Year |
The value range and precision of DATETIME, TIMESTAMP, and TIME depend on the scale. The scale attribute indicates the maximum number of significant digits in the fractional part, with a maximum value of 6 and a default value of 0.