The time format is 2008-06-16
Query the current day’s data:
SELECT * FROM `table` WHERE date (time field) = curdate();
Query the current month’s field:
SELECT *
FROM `table`
WHERE month(time field) = month( now( ) ) ;
The time format is 1219876... UNIX time, just apply the "FROM_UNIXTIME( )" function
For example, to query the current month:
SELECT *
FROM `table`
WHERE month( from_unixtime( reg_time ) ) = month( now( ) ) ;
How about querying the previous month? Be flexible!
SELECT *
FROM `table`
WHERE month( from_unixtime( reg_time ) ) = month( now( ) ) -1;
It’s that simple, more complicated ones will be added later!