OceanBase Database supports the DATE, TIME, DATETIME, TIMESTAMP, and YEAR types for representing time values. Each type has a valid value range and a "zero" value, and can represent invalid values that cannot be represented.
The following table describes the date and time types supported in the current version of OceanBase Database and related information.
| Type | Format | Lower bound | Upper bound | Description |
|---|---|---|---|---|
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 (time zone-insensitive) |
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 (time zone-sensitive) |
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 attribute. The Scale attribute specifies the maximum number of valid decimal digits, with a maximum value of 6 and a default value of 0.
