我想在下周展示,如果它在星期四 13:00 之后它应该返回 +2 周(下周之后的一周)。如果不是周末,此代码可以正常工作。它在星期五之后给出错误的开始日期。什么会导致这个?
$current_time = strtotime('now');
if ($current_time < strtotime('thursday this week 13:00')) {
$week_start = date('d/m/Y', strtotime('this week next monday', strtotime(date('d-m-Y'))));
$week_end = date('d/m/Y', strtotime('next week next sunday', strtotime(date('d-m-Y'))));
} else {
if (date('N') > 5) {
$week_start = date('d/m/Y', strtotime('+2 week next monday', strtotime(date('d-m-Y'))));
} else {
$week_start = date('d/m/Y', strtotime('next week next monday', strtotime(date('d-m-Y'))));
}
$week_end = date('d/m/Y', strtotime('+2 week next sunday', strtotime(date('d-m-Y'))));
}
return $week_start." - ".$week_end;