About the three date types in Mysql

Source: Internet
Author: User

After two insert date types recently, the value is 0000-00-00 00:00:00, so I checked the official documentation and found the reason.

In Mysql, we often use three data types to store dates: Date, Datetime, and Timestamp.

The Date data type is used to store dates without time. Mysql gets and displays this type in the format of YYYY-MM-DD ". The supported time range is "1000-00-00" to "9999-12-31 ".

Datetime stores data with both date and time. The storage and display format is YYYY-MM-DD HH: MM: SS ". The supported time range is "1000-00-00 00:00:00" to "9999-12-31 23:59:59 ".

The Timestamp type also stores data with both dates and time. The storage and display formats are the same as those of Datetime. The supported time range is "00:00:01" to "03:14:07 ".

All data that does not conform to the preceding format will be converted to a value of 0 of the corresponding type. (Or 0000-00-00 00:00:00)

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.