我正在使用一个mySQL数据库来存储为模型提供信息的一系列输入。我有许多不同的日期作为时间戳存储。然而,其中的一些价值可能是几百年后的未来。当我查看DB时,它们被存储为“0000-00-00:00:00”,而实际的时间戳应该是'2850-12-01 : 00:00:00‘。
在Google上搜索时,我注意到最大值是在2038年的某个时候。有没有人找到一个更长的时间戳的解决方案?
发布于 2016-11-24 21:34:47
你可以把它们转换成DATETIME,它会存储你想要的东西。比较:
MariaDB [test]> create table t (t timestamp, d datetime);
Query OK, 0 rows affected (0.59 sec)
MariaDB [test]> insert into t values ('2850-12-01 00:00:00','2850-12-01 00:00:00');
Query OK, 1 row affected, 1 warning (0.08 sec)
MariaDB [test]> select * from t;
+---------------------+---------------------+
| t | d |
+---------------------+---------------------+
| 0000-00-00 00:00:00 | 2850-12-01 00:00:00 |
+---------------------+---------------------+
1 row in set (0.00 sec)https://stackoverflow.com/questions/40794600
复制相似问题