PHP获取本周第一天和最后一天
<br />//本周的第一天和最后一天<br />$date=new DateTime();<br />$date->modify('this week');<br />$first_day_of_week=$date->format('Y-m-d');<br />$date->modify('this week +6 days');<br />$end_day_of_week=$date->format('Y-m-d');<br />
echo date('Y-m-d w', strtotime('this week'));<br />2014-02-17 1
echo date('Y-m-d w', strtotime('last day this week'));<br />2014-02-16 0
echo date('Y-m-d w', strtotime('last day this week +6 day'));2014-02-22 6
<br />echo date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w'),date('Y'))); // 第一天<br />echo date('Y-m-d',mktime(0,0,0,date('m'),date('d')+(6-date('w')),date('Y'))); // 最后一天<br />