$beginMon=strtotime("-1 week Monday");
$endMon=strtotime("-1 week Tuesday")-1;
echo date("Y-m-d H:i:s", $beginMon);
echo('<br/>');
echo date("Y-m-d H:i:s", $endMon);
echo("<br />");
//上面是获取本周一的开始与结束时间戳
//结果如下:
//2015-01-05 00:00:00(错误)
//2014-12-29 23:59:59(正确)
$beginSun=strtotime("+0 week Sunday");
$endSun=strtotime("+1 week Monday")-1;
echo date("Y-m-d H:i:s", $beginSun)."<br />";
echo date("Y-m-d H:i:s",$endSun)."<br />";
//上面获取的是本周末的开始与结束时间戳
//结果如下:
//2015-01-04 00:00:00
//2015-01-11 23:59:59(错误)
//以上案例都是在今天测试(非周末 因为周末)
1
revlis7 2014-12-30 23:29:30 +08:00
dayname - Moves to the next day of this name.
|