mysql 时间字段介绍
mysql> help DATETIME A date and time combination. The supported range is '1000-01-0100:00:00.000000' to '9999-12-31 23:59:59.999999'. MySQL displays
DATETIME values in 'YYYY-MM-DD HH:MM:SS[.fraction]' format, but permits
assignment of values to DATETIME columns using either strings or
numbers.
An optional fsp value in the range from 0 to 6 may be given to specify
fractional seconds precision. A value of 0 signifies that there is no
fractional part. If omitted, the default precision is 0.
Automatic initialization and updating to the current date and time for
DATETIME columns can be specified using DEFAULT and ON UPDATE column
definition clauses, as described in
http://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html.
20180615135025
'2018-06-15 13:50:25'
存储的是字符串
mysql> INSERTINTO t1 (d1_data,d2_time,d3_datatime,d4_year,d5_timestamp) VALUES(20180515,135025,20180615135025,'2018','2018-06-15 13:50:25');
Query OK, 1 row affected (0.01 sec)
mysql> select * from t1 where> *************************** 1. row ***************************
id: 5
d1_data: 2018-05-15
d2_time: 13:50:25
d3_datatime: 2018-06-15 13:50:25
d4_year: 2018
d5_timestamp: 2018-06-15 13:50:25
1 row in set (0.00 sec)
页:
[1]