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(字段)这种方法来获取确切的时间值。或者你自己写解析函数。
echo date("Y-M-d, H:i a",mktime(20,21,44,01,08,2003));
好象是2003-01-08 20:21:44的一种特殊表示形式。
我这儿有两种标准的时间表示形式
1040355114(精确到秒)
1041901270.058(精确到毫秒)
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(字段)这种方法来获取确切的时间值。或者你自己写解析函数。