Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

DATETIME

Description

The DATETIME data type is used to represent a data value in which the data (year, month, date) and time (hour, minute, second) are combined. Representable range is from GMT 0001-01-01 00:00:00.000 to 9999-12-31 23:59:59.999.

'hh:mi [:ss[.msec]] [am|pm] mm/dd [/yyyy]'

'hh:mi [:ss[.msec]] [am|pm] [yyyy-]mm-dd'

'mm/dd[/yyyy] hh:mi[:ss[.ff]] [am|pm]'

'[yyyy-]mm-dd hh:mi[:ss[.ff]] [am|pm]'

Remark
  • All fields must be entered as integer.
  • If you year is omitted, the current year is specified by default. If the value (hour, minute/second) is omitted, 12:00:00.000 AM is specified.
  • You can store the timestamp value of the system in the DATETIME type by using the SYS_DATETIME (or SYSDATETIME, CURRENT_DATETIME, CURRENT_DATETIME(), NOW()) function. Note that the timestamp value is specified as a default value at the time of creating the table, not at the time of INSERT the data, if SYS_DATETIME is specified as a DEFAULT value for a DATETIME column when creating a table.
  • The TO_DATETIME() function is used to cast a character string type into a DATETIME type.
Example

DATETIME '10/31' is outputted as '12:00:00.000 AM 10/31/2011' (if year/time is omitted, a default value is outputted).

DATETIME '10/31/2008' is outputted as '12:00:00.000 AM 10/31/2008'.

DATETIME '13:15:45 10/31/2008' is outputted as '01:15:45.000 PM 10/31/2008'.

DATETIME '01:15:45 PM 2008-10-31' is outputted as '01:15:45.000 PM 10/31/2008'.

DATETIME '13:15:45 2008-10-31' is outputted as '01:15:45.000 PM 10/31/2008'.

DATETIME '10/31/2008 01:15:45 PM' is outputted as '01:15:45.000 PM 10/31/2008'.

DATETIME '10/31/2008 13:15:45' is outputted as '01:15:45.000 PM 10/31/2008'.

DATETIME '2008-10-31 01:15:45 PM' is outputted as '01:15:45.000 PM 10/31/2008'.

DATETIME '2008-10-31 13:15:45' is outputted as '01:15:45.000 PM 10/31/2008'.

DATETIME '2099-10-31 01:15:45 PM' is outputted as '01:15:45.000 PM 10/31/2099'.