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 | 



TIMESTAMP

Description

The TIMESTAMP data type is used to represent a data value in which the date (year, month, date) and time (hour, minute, second) are combined. The range of representable value is between GMT 1970-01-01 00:00:01 and 2038-01-19 03:14:07. The DATETIME type can be used if the value is out of range or data in milliseconds is stored.

The input format of TIMESTAMP is as follows:

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

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

 

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

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

Remark
  • All fields must be entered in integer format.
  • If the year is omitted, the current year is specified by default. If the time value (hour/minute/second) is omitted, 12:00:00 AM is specified.
  • You can store the timestamp value of the system in the TIMESTAMP type by using the SYS_TIMESTAMP (or SYSTIMESTAMP, CURRENT_TIMESTAMP) 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_TIMESTAMP is specified as a DEFAULT value for a TIMESTAMP column when creating a table.
  • The TIMESTAMP() or TO_TIMESTAMP() function is used to cast a character string type into a TIMESTAMP type.
  • 0 is not allowed to input in year, month, and day; however, '0000-00-00 00:00:00', which every digit consisting of year, month, day, hour, minute, and second is 0, is allowed as an exception.
Example

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

TIMESTAMP '10/31/2008' is outputted as '12:00:00 AM 10/31/2008' (if the value for time is omitted, a default value is outputted ).

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

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

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

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

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

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

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

An error occurs on TIMESTAMP '2099-10-31 01:15:45 PM' (out of range to represent TIMESTAMP).