datetime 和 timestamp 的区别

1 表现方式: 都为 YYYY-MM-DD HH:MM:SS

2 范围:timestamp的范围没有datetime的大, timestamp值不能早于1970或晚于2037

3 存储格式:timestamp4个字节、存储毫秒数字、读取时需要时区转换, datetime8个字节、显示是什么它存的就是什么、和时区无关

4 Timestamps in MySQL generally used to track changes to records, and are often updated every time the record is changed. If you want to store a specific value you should use a datetime field

原文地址:https://www.cnblogs.com/yxmfighting/p/7799031.html