我可以通过以下方式获得本周的星期一:$monday = date_create()->modify('this Monday');我想在本月1日得到同样的放心。我该如何实现?
3 回答

守着一只汪
TA贡献1872条经验 获得超3个赞
这就是您需要的一切:
$week_start = strtotime('last Sunday', time());
$week_end = strtotime('next Sunday', time());
$month_start = strtotime('first day of this month', time());
$month_end = strtotime('last day of this month', time());
$year_start = strtotime('first day of January', time());
$year_end = strtotime('last day of December', time());
echo date('D, M jS Y', $week_start).'<br/>';
echo date('D, M jS Y', $week_end).'<br/>';
echo date('D, M jS Y', $month_start).'<br/>';
echo date('D, M jS Y', $month_end).'<br/>';
echo date('D, M jS Y', $year_start).'<br/>';
echo date('D, M jS Y', $year_end).'<br/>';
- 3 回答
- 0 关注
- 349 浏览
添加回答
举报
0/150
提交
取消