date_default_timezone_set('PRC');
$last_week_first = strtotime(date('Y-m-01', strtotime('-1 week')));
$last_week_last = strtotime(date('Y-m-d',$last_week_first)."+1 week -1 day");
$last_month_first = strtotime(date('Y-m-01', strtotime('-1 month')));
$last_month_last = strtotime(date('Y-m-d',$last_month_first)."+1 month -1 day");
$last_half_first = strtotime(date('Y-06-01', strtotime('-6 month')));
$last_half_last = strtotime(date('Y-m-d',$last_half_first)."+6 month -1 day");
$last_year_first = strtotime(date('Y-01-01', strtotime('-1 year')));
$last_year_last = strtotime(date('Y-m-d',$last_year_first)."+12 month -1 day");
echo date('Y-m-d',$last_week_first);
echo '<br />';
echo date('Y-m-d',$last_week_last);
echo '<br />';
echo date('Y-m-d',$last_month_first);
echo '<br />';
echo date('Y-m-d',$last_month_last);
echo '<br />';
echo date('Y-m-d',$last_half_first);
echo '<br />';
echo date('Y-m-d',$last_half_last);
echo '<br />';
echo date('Y-m-d',$last_year_first);
echo '<br />';
echo date('Y-m-d',$last_year_last);
注 : 时间不包含当天,因为只获取到00:00,如果需要包含当天请把 -1 day 删除,包含当天,但多一秒