您好,欢迎访问一九零五行业门户网

mysql取今日,明天,工作日,周末,本周,下周,下月数据

mysql取今天,明天,工作日,周末,本周,下周,下月数据 if ($date != '') {switch($date){//date_add 加 date_sub 减case '今天': $where .= and from_unixtime(starttimefrom,'%y-%m-%d') = curdate() ; break;case '明天': $where .= and from_unixt
mysql取今天,明天,工作日,周末,本周,下周,下月数据
if ($date != '') { switch($date){//date_add 加 date_sub 减 case '今天': $where .= and from_unixtime(starttimefrom,'%y-%m-%d') = curdate() ; break; case '明天': $where .= and from_unixtime(starttimefrom,'%y-%m-%d') = date_add(curdate(), interval 1 day); break; case '工作日': $where .= and dayofweek(from_unixtime(starttimefrom)) not in (1,7) ; break; case '周末': $where .= and dayofweek(from_unixtime(starttimefrom)) in (1,7) ; break; case '本周': $where .= and yearweek(from_unixtime(starttimefrom,'%y-%m-%d')) = yearweek(now()); break; case '下周': $where .= and ( from_unixtime(starttimefrom,'%y-%m-%d')>=subdate(curdate(),date_format(curdate(),'%w')-1) and from_unixtime(starttimefrom,'%y-%m-%d')<=subdate(curdate(),date_format(curdate(),'%w')-7) ) ; break; case '下月': $where .= and from_unixtime(starttimefrom,'%y-%m') = date_format(date_add(curdate(), interval 1 month),'%y-%m') ; break; default: } }
?
其它类似信息

推荐信息