//获取星期几 function wk($date1) { $datearr = explode("-",$date1); //将传来的时间使用“-”分割成数组 $year = $datearr[0]; //获取年份 $month = sprintf('%02d',$datearr[1]); //获取月份 $day = sprintf('%02d',$datearr[2]); //获取日期 $hour = $minute = $second = 0; //默认时分秒均为0 $dayofweek = mktime($hour,$minute,$second,$month,$day,$year); //将时间转换成时间戳 $shuchu = date("w",$dayofweek); //获取星期值 $weekarray=array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); return $weekarray[$shuchu]; } $time = date('Y-m-d',time()); $totime = wk($time); echo $totime ;