MySQL date data type datetime.
##datetime type: can be used for values that need to contain both date and time information. (Recommended learning: MySQL video tutorial)
datetime:MySQL retrieves and displays the DATETIME type in the 'YYYY-MM-DD HH:mm:ss' format.
Range | Format | Use | ||
The code to create a table is:
create table t8 ( `id1` timestamp NOT NULL default CURRENT_TIMESTAMP, `id2` datetime default NULL );
Comparison between the two:
1. The range supported by timestamp is smaller than that of timedate. And it is easy to exceed the situation2.timestamp is more affected by the time zone, the MYSQL version and the SQL MODE of the server.For more MySQL related technical articles, please visitMySQL database graphic tutorial column to learn!
The above is the detailed content of datetime data type. For more information, please follow other related articles on the PHP Chinese website!