//返回日期所在周是第几月第几周
public function get_week_num(){
// 当前日期
$sdefaultDate = '2020-07-01';
$first=1;
$w = date('w', strtotime($sdefaultDate));
//获取当前日期所在周的周一日期
$week_start=date('Y-m-d', strtotime("$sdefaultDate -".($w ? $w - $first : 6).' days'));
$m = date('Ym',strtotime($week_start)); //周一所属月份
$start = date('Ym01',strtotime($week_start)); //当月一号
$end = date('Ymd',strtotime($week_start)); //周一所在日期
$n = 0;
for($i = $start;$i <= $end;$i++){
if(date('w',strtotime($i)) == 1){
$n++;
}
}
return $m.$n;
}
Return format 2020065
Indicates that it is in the fifth week of June 2020