MySQL Timestamp valid range

Source: Internet
Author: User

Things

From_unixtime/unix_timestamp overflow, unable to use

Cause

From_unixtime returns the number of seconds from 1970-01-01 to the present, which is the result of the int, and the valid range of int is [ -2^31 + 1, 2^31-1], i.e. [-2147483648, 2147483648], 2147483648 /365/24/3600 conversion Adult also for more than 68 years, the maximum validity is one day in 2038.

Processing

Compatibility with previous processing, can be used first, then minus 30, you can temporarily scale back 30.

Select Date_add (From_unixtime (2524464000-946656000), interval year);

Select (Unix_timestamp (Date_add (' 2050-01-01 00:00:00 ', interval-30 year)) + 946656000);


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

MySQL Timestamp valid range

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.