时间:2021-07-01 10:21:17 帮助过:8人阅读
function getWeek($day){
$days = array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');
$day = explode('-',$day);
return $days[date('w',mktime(0,0,0,$day[1],$day[2],$day[0]))];
}
for($i = 0;$i < 7;$i++){
$day = date('Y-m-d',strtotime(''.($i+1).' day'));
echo $day."(".getWeek($day).")";
}
?>
function getWeek($day){
$days = array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');
return $days[date('w', strtotime($day))];
}
$date = '2014-09-29';
if($w = date('w', strtotime($date))) $date = date('Y-m-d', strtotime("-$w day $date"));
for($i = 0;$i < 7;$i++){
$day = date('Y-m-d',strtotime("$i day $date"));
echo $day."(".getWeek($day).")\n";
}