MySQL Date and Time type

Source: Internet
Author: User

Current_time Display current time now () displays the current datetime date and time type Year 1 byte 1901~2155 0 value 0000DATE 4 byte 1000-01-01~9999-12-31 0 value 0000:00:00time 3 bytes- 838:59:59~838:59:59 0 Value 00:00:00datetime 8 byte 1000-01-01 00:00:00~9999-12-31 23:59:59 0 value 0000-00-00 00:00:00timestamp 4 bytes 19700101080001~20380119111407 00000000000000 Note: Inserting the data beyond the range inserts 0 values into the database table in the year type insert format 0000 or "0000" Time Type Insert format "D HH:MM:SS" ( This should have quotation marks, D for the number of days, d*24 after the hour), or number format HHMMSS or string format "Hhmmss" (both of which have the same quotation marks), display format HH:MM:SS, delimiter cannot be used other symbols, minutes, seconds range 0~59, the hour range 0~ 23 Example: Insert "2 23:50:50", "22:22:22", "11:11", "2 20", "30" into the table: 71:50:50,22:22:22,11:11:00,68,00:00:30date type Insert Format: " Yyyy-mm-dd "or" YYYYMMDD "format string representation, and any punctuation can also be used as separators such as: ' @ ', ' * ', display format YYYY-MM-DD. DATETIME type Insert format: "Yyyy-mm-dd HH:MM:SS" or "YYYYMMDDHHMMSS", display format: "Yyyy-mm-dd HH:MM:SS", In addition, any punctuation can also be used as a delimiter timestamp type format date and time insert format and display format are consistent with DateTime types, and date ranges are smaller than datetime types. Any punctuation marks can also be used as separators. Enter Current_timestamp or enter null or no input to insert the current date and time into the system. Note: This type of time is displayed according to the time zone, such as in the East eight area inserted in the time of 2008-09-30 14:21:25, in the East seven area shown as 2008-09-30 13:21:25.

MySQL Date and Time type

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.