Mysql basics: mysql column type-time and date

Source: Internet
Author: User

Mysql basics: mysql column type-time and DATE. The supported range is '2017-01-01 'to '2017-12-31 '. MySQL displays the DATE value in 'yyyy-MM-DD 'format, but allows you to assign a value to the DATE column using strings or numbers. · Combination of DATETIME date and time. The supported range is '2017-01-01 00:00:00 'to '2017-12-31 23:59:59 '. MySQL displays DATETIME values in 'yyyy-MM-DD HH: MM: ss' format, but allows values to be assigned to DATETIME columns using strings or numbers. · TIMESTAMP [(M)] TIMESTAMP. The range is '2017-01-01 00:00:00 'to July 22, 1970. The TIMESTAMP column is used to record the date and time during INSERT or UPDATE operations. If you do not assign a value, the first TIMESTAMP column in the table is automatically set to the date and time of the last operation. You can also assign a NULL value to set the TIMESTAMP column to the current date and time. Returns a string in 'yyyy-MM-DD HH: MM: ss' format with a fixed display width of 19 characters. To obtain the numeric value, add + 0 to the TIMESTAMP column. Note: The TIMESTAMP format used before MySQL 4.1 is not supported in MySQL 5.1. For information about the old format, see MySQL 4.1 reference manual. · TIME. The value range is '-838: 59: 59' to '2014: 59: 59 '. MySQL displays the TIME value in 'hh: MM: ss' format, but allows you to assign a value to the TIME column using strings or numbers. · YEAR [(2 | 4)] YEAR in two or four-digit format. The default format is four bits. In the four-digit format, the allowed values are 1901 to 2155 and 0000. In the two-digit format, the allowed values are 70 to 69, indicating that the value ranges from January 1, 1970 to January 1, 2069. MySQL displays the YEAR Value in YYYY format, but allows you to assign a value to the YEAR column using a string or number.

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.