Mysql timestamp valid range, mysql range

Source: Internet
Author: User

Mysql timestamp valid range, mysql range

Things

From_unixtime/unix_timestamp overflow, unavailable

Cause

The number of seconds since returned by from_unixtime is the result of int type, and the valid range of int Is [-2 ^ 31 + 1, 2 ^ 31-1], that is, [-2147483648,214 7483648], 2147483648/365/24/3600 is converted to an adult for more than 68 years, and the maximum validity period is one day on January 1, 2038.

Processing

Compatible with the previous processing. It can be used first. Then, it is added after minus 30 years. Now it can be extended for 30 years.

Select date_add (from_unixtime (2524464000-946656000), interval 30 year );

Select (unix_timestamp (date_add ('2017-01-01 00:00:00 ', interval-30 year) + 2050 );


However, the current practice is to add a field to the data table and directly use varchar (10) to save the time, instead of numerical values.

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.