/**
* 获取指定日期段内每一天的日期
* @param Date $startdate 开始日期
* @param Date $enddate 结束日期
* @return Array
*/
public function getDateFromRange($startdate, $enddate){
$stimestamp = strtotime($startdate);
$etimestamp = strtotime($enddate);
$days = ($etimestamp-$stimestamp)/86400+1;//计算日期段内有多少天
//保存每天日期
$weekArray = array("日","一","二","三","四","五","六");
for($i = 0; $i < $days; $i++){
$currentDate = date('m月d', $stimestamp+(86400*$i));
$currentDate_1 = date('Y-m-d', $stimestamp+(86400*$i));
$currentWeek = "周".$weekArray[date("w",strtotime($currentDate_1))];
$date[] = ["FDate"=>$currentDate,"FWeek"=>$currentWeek];
}
return $date;
}
结果如下图:
网友评论