MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME.) By default, the current time zone for each connection is the server's time. The time zone can be set on a per-connection basis. As long as the time zone setting remains constant, you get back the same value you store. If you store a TIMESTAMP value, and then change the time zone and retrieve the value, the retrieved value is different from the value you stored
根据 MySQL 官方文档, TIMESTAMP 在存入时, 会根据当前时区转换为 UTC 时间, 而在取出也会根据当前时区将 UTC 时间转换为 TIMESTAMP. 因此如果你的程序的时区有变化时, 那么写入和读出的 TIMESTAMP 就不一样了.
你需要考虑到 timestamp 潜在的时区问题:
根据 MySQL 官方文档, TIMESTAMP 在存入时, 会根据当前时区转换为 UTC 时间, 而在取出也会根据当前时区将 UTC 时间转换为 TIMESTAMP. 因此如果你的程序的时区有变化时, 那么写入和读出的 TIMESTAMP 就不一样了.
如果没有上面的时区的问题, 那么我觉得 TIMESTAMP 比较好一些.