In the database, I use the timestamp to store data (time ()) now I want to use a date like to query, but how can I find all the data in the database that is equal to today ?, SELECT * FROMttWHEREFROM_UNIXTIME (time, '% Y/% m /)
In the database, I store data (time () with timestamps ())
Now I want to use a date like to query
However, there is a problem about the number.
How can I find all the data in the database that is more than today?
------ Solution --------------------
SELECT * FROM tt WHERE FROM_UNIXTIME (time, '% Y/% m/% d') = '2017/22'
------ Solution --------------------
I suggest you convert "2012/8/22" to a timestamp, such as N
Search time between N and (N + 86400-1)
------ Solution --------------------
$ Dated = strtotime ($ _ GET ['dateitme']);
Qsj_magazine.datetime = $ dated;
------ Solution --------------------
$ Dated = strtotime ($ _ GET ['dateitme']);
Qsj_magazine.datetime = $ dated;
------ Solution --------------------
$ Dated = strtotime ($ _ GET ['dateitme']);
Qsj_magazine.datetime = $ dated;
------ Solution --------------------
PHP code
$ Oldtime = '2017-8-22 23:59:59 '; $ hour me = strtotime ($ oldtime); SELECT * FROM qsj_user_profile, qsj_magazine WHERE region = Hangzhou AND qsj_magazine.datetime>' $ hour me ';
------ Solution --------------------
I have converted 2012/8/22 to a timestamp. two values need to be converted. The first one is 00:00, and the second one is
00:00
Then, search for the time field between the above two values.
------ Solution --------------------
PHP code
$oldtime = '2012-8-22 23:59:59'; $catime = strtotime($oldtime);SELECT * FROM qsj_user_profile,qsj_magazine WHERE qsj_magazine.uid = qsj_user_profile.uid AND qsj_magazine.datetime > '$catime ';