玩转PHP的date函数
2018-08-15 本文已影响0人
CGM民
$time为传入的时间戳
获取指定时间戳的周一零点时间
$week_start_time = $time - ((date('N', $time) - 1) * 86400);
echo date('Y-m-d 00:00:00', $week_start_time);
获取指定时间戳的周日结束的时间
$week_end_time = $time + ((7 - date('N', $time)) * 86400);
echo date('Y-m-d 23:59:59', $week_end_time);