MySQL数据库中,与时间有关的类型有 DATE,TIME,TIMESTAMP:
时间戳
Query OK, 0 rows affected (0.13 sec)
mysql> desc date;
+-------+-----------+------+-----+-------------------+-----------------------------+
| Field | Type
+-------+-----------+------+-----+-------------------+-----------------------------+
| f1
+-------+-----------+------+-----+-------------------+-----------------------------+
具体范围如下
mysql> insert into tsvalues(19700101080001);
Query OK, 1 row affected (0.20 sec)
mysql> insert into ts values(20371231235959);
Query OK, 1 row affected (0.19 sec)
mysql> select * from ts ;
+---------------------+
| f1
+---------------------+
| 1970-01-01 08:00:01 |
| 2037-12-31 23:59:59 |
+---------------------+
2 rows in set (0.00 sec)
格式
yyyymmddhhmmss、yymmddhhmmss、yyyymmdd或yymmdd格式<