All Products
Search
Document Center

Overview of datetime and interval data types

Last Updated: Jun 18, 2021

ApsaraDB for OceanBase supports datetime and interval data types. These data types are the same as those in Oracle.

Datetime data types

The datetime data types are used to store date and time data that is stored in databases. This category consists of the following data types.

Data type

Description

DATE

Stores date and time information. The precision is seconds. The information about time zones is excluded.

TIMESTAMP

Serves as an extension of the DATE data type. The precision is nanoseconds. The information about time zones is excluded.

TIMESTAMP WITH TIME ZONE

Serves as an extension of the DATE data type. The precision is nanoseconds. The information about time zones is included.

TIMESTAMP WITH LOCAL TIME ZONE

Stores the information about database time zones. This data type stores TIMESTAMP values that contain the information about the local time zone.

Interval data types

Interval data types are different from datetime data types in the following aspect: Datetime data types store specific time points and interval data types store time periods. Interval data types provide an effective way to store the difference between each two datetime values. This category consists of the following data types.

Data typeDescription

INTERVAL YEAR TO MONTH

Stores time periods that are measured in years and months.

INTERVAL DAY TO SECOND

Stores time periods that are measured in days, hours, minutes, and seconds.

More information