我正在尝试在 PHP 中构建一个函数,这取决于日期会给我
本周(周一至周日)20/8/12 至 26/8/12
下周+1(周一至周日)27/8/12 至 02/9/12
下周+2(周一至周日)03/9/12 至 09/9/12
下周+3(周一至周日)
下周+4(周一至周日)
下周+5(周一至周日)
我尝试过使用以下内容,但是有什么更清洁的吗?
$week0_mon = date("Y-m-d", strtotime(date("Y").'W'.date('W')."1"));
$week0_sun = date("Y-m-d", strtotime(date("Y").'W'.date('W')."7"));
$week1_mon = date("Y-m-d", strtotime(date("Y-m-d", strtotime($week0_mon)) . " +1 week"));
$week1_sun = date("Y-m-d", strtotime(date("Y-m-d", strtotime($week0_sun)) . " +1 week"));
echo $week0_mon.' to '.$week0_sun.'<br />';
echo $week1_mon.' to '.$week1_sun.'<br />';