In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about what the timestamp range is in MYSQL. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
TIMESTAMP and DATETIME have different value ranges and different simultaneous storage.
TIMESTAMP takes up four bytes and ranges from 1970-01-01 00:00:00 to 2038-01-19 3:14:07
So why is this value range? 4 bytes is obviously not enough to store the date format. 4 bytes to the power of 2^32
Then we can analyze timestamp is actually a C language INT type with signed bits.
Calculated in Oracle format as
SQL> select to_date('1970-01-01 00:00:00','yyyy-mm-dd hh34:mi:ss')+(power(2,31)-1)/(60*60*24) from dual;
TO_DATE('1970-01-0100:00:00','
------------------------------
2038/1/19 3:14:07
2^31 is because the sign bit is missing one bit. So it's 31, and minus one because it starts at 0 instead of 1, like 2 to the eighth is 256, but the actual number is 0 to 255(FF).
And you can think of TIMESTAMP as actually an additive process, and it's stored internally in the form of a signed bit of type int for seconds.
Thank you for reading! About "MYSQL timestamp value range is what" this article is shared here, I hope the above content can be of some help to everyone, so that we can learn more knowledge, if you think the article is good, you can share it to let more people see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.