Reputation: 182
I'm using MySQL 5.7.20, Ubuntu 16.04.
My queries are:
mysql> CREATE TABLE test (ts TIMESTAMP NULL);
mysql> INSERT INTO test VALUES (1513776043);
mysql> SELECT * FROM test;
+---------------------+
| ts |
+---------------------+
| 0000-00-00 00:00:00 |
+---------------------+
As you see, timestamp not saved. How to store timestamp in MySQL?
Upvotes: 0
Views: 95
Reputation: 23011
You'll need to convert it with from_unixtime()
, since that is a unix timestamp.
INSERT INTO test VALUES (FROM_UNIXTIME(1513776043));
Upvotes: 2