The following table describes the date and time data types supported in OceanBase Database.
| Type | Format | Lower bound | Upper bound | Description |
|---|---|---|---|---|
DATETIME |
YYYY-MM-DD HH:MM:SS[.fraction] | 0000-01-01 00:00:00.000000 | 9999-12-31 23:59:59.999999 | The date and time exclusive of the time zone |
TIMESTAMP |
YYYY-MM-DD HH:MM:SS[.fraction] | 0000-01-01 00:00:00.000000 | 9999-12-31 23:59:59.999999 | The date and time inclusive of the time zone |
DATE |
YYYY-MM-DD | 0000-01-01 | 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. This attribute specifies the maximum number of valid digits in the fractional part. The maximum value is 6, and the default value is 0.