//查今天到明天之间的数据
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$tomorrow = mktime(0,0,0,date("m"),date("d",strtotime("+1day")),date("Y"));
select * from table as a where $today <= a.time and $tomorrow >= a.time;
select * from table where time between $today and $tomorrow;
//查询本周数据
$today = date("N"); //获得今天周几 1-7 表示星期1到周日
$mon_tmp = strtotime("-".$today."day");
$sun_tmp = strtotime("+".(7-$today)."day");
$mon = mktime(0,0,0,date("m",$mon_tmp),date("d",$mon_tmp),date("Y",$mon_tmp));
$sun = mktime(0,0,0,date("m",$sun_tmp ),date("d",$sun_tmp ),date("Y",$sun_tmp));
select * from table as a where $mon <= a.time and $sun >= a.time;
select * from table where time between $mon and $sun;