【发布时间】:2013-11-23 12:04:44
【问题描述】:
我想echo 下周从 Mo,Tu,We,Th,Fr,Sa,Su 开始的日期。
我的代码现在是这样的:
$date_monday = date("Y-m-d", strtotime('next monday'));
$date_tuesday = date("Y-m-d", strtotime('next tuesday'));
$date_wednesday = date("Y-m-d", strtotime('next wednesday'));
$date_thursday = date("Y-m-d", strtotime('next thursday'));
$date_friday = date("Y-m-d", strtotime('next friday'));
$date_saturday = date("Y-m-d", strtotime('next saturday'));
$date_sunday = date("Y-m-d", strtotime('next sunday'));
问题是,例如sunday 的日期是错误的,因为下个星期日是明天,但我想要从下个星期的星期日开始的日期。
有没有办法将 PHP 日期设置为星期日并计算新日期的天数?
【问题讨论】: