Introduction to DB2 datetime Data Types

Source: Internet
Author: User
Tags db2 date ranges

The DB2 datetime data type is one of the Data Types in the DB2 database. The following section describes the DB2 datetime data types for you.

DB2 datetime data types include DATE, TIME, and TIMESTAMP. Datetime values can be used in some arithmetic and string operations and are compatible with some strings, but they are neither strings nor numbers.

* DATE: DATE is a three-part value year, month, and day ). The year range is from 0001 to 9999. The range of month is from 1 to 12. The range of day is from 1 to n, where the value of n depends on the month. The DATE column is 10 bytes long.

* TIME: TIME is a value consisting of three parts: hour, minute, and second ). The hour range is from 0 to 24. The minute and second ranges from 0 to 59. If the hour is 24, the values of minute and second are both 0. The TIME column is 8 bytes long.

* TIMESTAMP: TIMESTAMP is a value that consists of seven parts: year, month, day, hour, minute, second, And microsecond ). The year range is from 0001 to 9999. The range of month is from 1 to 12. The range of day is from 1 to n, where the value of n depends on the month. The hour range is from 0 to 24. The minute and second ranges from 0 to 59. The microsecond part ranges from 000000 to 999999. If the hour is 24, the minute value, second value, and microsecond value are both 0. The TIMESTAMP column is 26 bytes long. String Representation of the datetime value: although the internal representation of the values of DATE, TIME, and TIMESTAMP is transparent to users, the DATE, TIME, and TIMESTAMP can also be expressed in strings, for the CHAR scalar function, see "part of speech parts of speech)" in SQL. It can be used to create a string representation of a date and time value.

* A date value string is a string of no less than 8 characters starting with a number. The minus zero in the month and day of the date value can be omitted.

* A Time Value string starts with a number and is a string of no less than four characters. The hour part of the time value can be omitted, and the second part can be completely omitted. If the second value is not specified, it is regarded as 0.

* The string of the time stamp value indicates a string starting with a number and with a length of not less than 16 characters. The complete time stamp string is represented as a yyyy-mm-dd-hh.mm.ss.nnnnnn. The zeros in front of the month, day, or hour of the time stamp value can be omitted, and the microseconds can be truncated or completely omitted. If the microsecond part of the timestamp value is omitted at the end of zero, it is assumed that the number of vacant digits is zero.

The preceding section describes the DB2 Date and Time data types.

Introduction to DB2 numeric data types

How to install a DB2 database in LINUX

DB2 Management page size limit

DB2 database startup failure Solution

Policy Selection for DB2 environment variable Management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.