I have a field timestamp in the mysql database. how can I query data between different time ranges? mysql & nbsp; has a field Reg_addtime, which is the time value stored in the timestamp mode. How can I query, for example, the list of registered members from January 1, May 1, 2013 to January 1, May 10, 2013. I am not satisfied with a small dish. half a bottle is full. Give me some advice. I have a timestamp for a field in the mysql database. how can I query data between different dates?
Mysql has a field, Reg_addtime, which is the time value stored in the timestamp mode.
How can I query, for example, the list of registered members from January 1, May 1, 2013 to January 1, May 10, 2013.
I am not satisfied with a small dish. half a bottle is full. Give me some advice.
Share:
------ Solution --------------------
SELECT * FROM tbl_name WHERE FROM_UNIXTIME (Reg_addtime, '% Y-% m-% d') BETWEEN '2017-05-01' AND '2017-05-10'
------ Solution --------------------
You can also do this:
Select * from order where timestamp between UNIX_TIMESTAMP ('2017-05-01 00:00:00 ') and UNIX_TIMESTAMP ('2017-05-10 00:00:00 ');