获取上一周到现在的所有时间,
例如今天是2017-8-15,
需要获取2017-8-8,2017-8-9,2017-8-10,2017-8-11,2017-8-12,2017-8-13,2017-8-14
这7天,然后放到数组中
获取上一周到现在的所有时间,
例如今天是2017-8-15,
需要获取2017-8-8,2017-8-9,2017-8-10,2017-8-11,2017-8-12,2017-8-13,2017-8-14
这7天,然后放到数组中
<?php
function getWeekdays($day){
$weekdays = array();
$time = strtotime($day);
for($i = 6 ; $i > 0 ; $i--){
$weekdays[] = date("Y-m-d",strtotime("- {$i} days",$time));
}
$weekdays[] = $day;
return $weekdays;
}
echo "<pre>";
var_dump(getWeekDays("2017-08-15"));