Definition and Characteristics

Definition

DATE-TIME data types are used to represent the date or time (or both together). CUBRID supports the following data types:

Date-Time Types Supported by CUBRID

Type

Mim

Max

Note

DATE

0001-01-01

9999-12-31

As an exception, the TIMESTAMP '0000-00-00 00:00:00' value is allowed.

TIME

00:00:00

23:59:59

TIMESTAMP

1970-01-01 00:00:01 (GMT)
1970-01-01 09:00:01 (KST)

2038-01-10 03:14:07 (GMT)
2038-01-19 12:14:07 (KST)

As an exception, the TIMESTAMP '0000-00-00 00:00:00' value is allowed.

DATETIME

0001-01-01 00:00:000

9999-12-31 23:59:599

As an exception, the DATETIME '0000-00-00 00:00:00' value is allowed.

Characteristics

Range and Resolution

Coercions

The Date-Time types can be cast explicitly using the CAST operator only when they have the same field. For implicit coercion, see Implicit Type Conversion. The following table shows types that allows explicit coercions. For implicit coercion, see Arithmetic Operation and Type Casting of DATE/TIME Data Types.

Explicit Coercions

 

TO

FROM

 

DATE

TIME

DATETIME

TIMESTAMP

DATE

-

X

O

O

TIME

X

-

X

X

DATETIME

O

O

-

O

TIMESTAMP

O

O

O

-

Remarks

Every value of date and time can be 0 in DATE, DATETIME, or TIMESTAMP type. This is useful in terms that this value can be used if an index exists upon query execution of a column corresponding to the type.

For details, see the description of each function.