Urgent PHP: the createtime field type in the database is datetime. how can I convert the createtime field type to datetime, which is year, month, day, minute, and second based on the data database type in this query period? There is a lot of data, a good conversion, but so much?
Reply to discussion (solution)
select unix_timestamp('2011-4-19 12:00:00');
select unix_timestamp('2011-4-19 12:00:00');
My database is not in the timestamp format, but in the datetime format.
My database is not in the timestamp format, but in the datetime format.
Didn't you say you want to convert it into a timestamp? Unix_timestamp can convert your datetime format to a timestamp.
My database is not in the timestamp format, but in the datetime format.
Didn't you say you want to convert it into a timestamp? Unix_timestamp can convert your datetime format to a timestamp.
If the database is not a single piece of data, how can we convert so much data?
If the database is not a single piece of data, how can we convert so much data?
Select unix_timestamp (time field); the time field is the time field that you want to convert in the database.
You just need to directly compare it.
Select * from table1 where create_time> '2017-03-21 00:00:00'
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;
Select * from table where createtime> = '2017-01-01 00:00:00 'and creattime <'2017-01-31 00:00:00 ';