In an emergency, the createtime field type in the PHP database is datetime. how can we set the createtime field type in the data database to datetime based on the query time, which is year, month, day, hour, minute, second, how to convert it into a timestamp? There is a lot of data, a good conversion, but so much ?, Select & nbs urgent, PHP, the createtime field type in the database is datetime, how to query data within a period of time according to this
In the database, the createtime field is of the datetime type, which is year, month, day, hour, minute, and second. how can we convert it into a timestamp? There is a lot of data, a good conversion, but so much?
------ Solution --------------------
Select unix_timestamp ('2017-4-19 12:00:00 ');
------ Solution --------------------
Queries can be directly compared
For example, select * from table where createtime> = '2017-01-01 00:00:00 'and creattime <'2017-01-31 00:00:00 ';
This can be done if you want to batch display
Select *, unix_timestamp (createtime) as createtime from table;
------ Solution --------------------
Select * from table where createtime> = '2017-01-01 00:00:00 'and creattime <'2017-01-31 00:00:00 ';