About three types of dates in MySQL

Source: Internet
Author: User

There are three types of data that we often use to store dates in MySQL: date, Datetime, Timestamp.

The date data type is used to store dates that have no time. MySQL gets and displays the format of this type as "Yyyy-mm-dd". The supported time range is "1000-00-00" to "9999-12-31".

DateTime types store data that has both date and time. The format for storage and display 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".

Timestamp types are also data that stores both date and time. The format for storing and displaying is the same as DateTime. The supported time range is "1970-01-01 00:00:01" to "2038-01-19 03:14:07".

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

About three types of dates in MySQL

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.