我想显示当月的替代周日期。假设今天是本周三。所以我想显示本周一至周五的日期。我想在接下来的下一周(跳过一周)也一样。所以我想要
或
(这些日期在2014年的背景下描述)
答案 0 :(得分:0)
<?php
$date = new DateTime();
echo $date->format('dS M'); // today
echo "<br />";
$date->modify('this week'); // reset to firstday of the week, Monday
echo $date->format('dS M');
echo "<br />";
$date->modify('+1 day'); // add 1 day with current stored date
echo $date->format('dS M');
echo "<br />";
$date->modify('next week'); // go to next week
$date->modify('next week'); // doing this second time will add another week
echo $date->format('dS M'); // print first day of that week