mysql 5.6中的时间类型的新精度
在mysql 5.6中,time,timestamp,datetime都可以精确到微妙,并指定微秒的精确度了,
比如如下的例子:
CREATE TABLE `t` (
`id` int(11) AUTO_INCREMENT,
`t1` time(3),
`t2` timestamp(6),
`t3` datetime(1),
`t4` datetime,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
mysql> select * from t;
+----+--------------+----------------------------+-----------------------+---------------------+
| id | t1 | t2 | t3 | t4 |
+----+--------------+----------------------------+-----------------------+---------------------+
| 1 | 05:05:10.000 | 2013-07-04 05:05:10.000000 | 2013-07-04 05:05:10.0 | 2013-07-04 05:05:10 |
| 2 | 05:14:24.414 | 2013-07-04 05:14:24.125000 | 2013-07-04 05:14:24.4 | 2013-07-04 05:14:25 |
| 3 | 05:14:32.566 | 2013-07-04 05:14:32.207031 | 2013-07-04 05:14:32.3 | 2013-07-04 05:14:32 |
| 4 | 05:14:34.344 | 2013-07-04 05:14:34.507813 | 2013-07-04 05:14:34.5 | 2013-07-04 05:14:35 |
| 5 | 05:14:45.348 | 2013-07-04 05:14:45.832031 | 2013-07-04 05:14:45.1 | 2013-07-04 05:14:45 |
其中,在http://dev.mysql.com/doc/internals/en/date-and-time-data-type-representation.html中对mysql 5.6中的日期存储位数有了新的解析论述