Column type Display format
TIMESTAMP(14) YYYYMMDDHHMMSS
TIMESTAMP(12) YYMMDDHHMMSS
TIMESTAMP(10) YYMMDDHHMM
TIMESTAMP(8) YYYYMMDD
TIMESTAMP(6) YYMMDD
TIMESTAMP(4) YYMM
TIMESTAMP(2) YY
这种格式是mysql自己设置的时间格式,不能用标准的转换函数来转换。
Although TIMESTAMP values are stored to full precision, the only function that operates
directly on the underlying stored value is UNIX_TIMESTAMP(). Other functions operate
on the formatted retrieved value. This means you cannot use functions such as HOUR()
or SECOND() unless the relevant part of the TIMESTAMP value is included in the formatted
value. For example, the HH part of a TIMESTAMP column is not displayed unless the
display size is at least 10, so trying to use HOUR() on shorter TIMESTAMP values produces
a meaningless result.
也就是说只能用select UNIX_TIMESTAMP(字段)这种方法来获取确切的时间值。或者你自己写解析函数。