22
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQL:UNIX_TIMESTAMPの挿入

Posted at

UNIX_TIMESTAMPの挿入


mysql> INSERT INTO abc (id, timestamp) VALUES ('', UNIX_TIMESTAMP());

MySQLでタイムスタンプ確認方法

mysql> SELECT NOW() AS DATETIME;
+---------------------+
| DATETIME            |
+---------------------+
| 2014-01-20 17:25:27 |
+---------------------+
1 row in set (0.00 sec)

mysql> SELECT UNIX_TIMESTAMP() AS TIMESTAMP;
+------------+
| TIMESTAMP  |
+------------+
| 1390206355 |
+------------+
1 row in set (0.00 sec)

mysql> SELECT UNIX_TIMESTAMP('2013-06-15 19:37:33') AS TIMESTAMP;
+------------+
| TIMESTAMP  |
+------------+
| 1371292653 |
+------------+
1 row in set (0.00 sec)

mysql> SELECT FROM_UNIXTIME(1371292653) AS DATETIME;
+---------------------+
| DATETIME            |
+---------------------+
| 2013-06-15 19:37:33 |
+---------------------+
1 row in set (0.00 sec)
22
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?