3 回答

TA贡献1836条经验 获得超3个赞
将以下行添加到循环中:
echo (new DateTime($Date. '-'. $Month .'-'. $Year))->format('l');
它将使用您的数据和日期作为您请求的格式创建一个新的DateTime对象。

TA贡献1875条经验 获得超5个赞
下面的代码将打印出您所需要的。
$date1 = date('Y-m-01');
$Maximum_Date = date('t', strtotime($date1));
for($Date = 1; $Date <= $Maximum_Date; $Date++)
{
$thatDay = date('Y-m-'.$Date);
$day = date('l, j', strtotime($thatDay));
$Month = date('m', strtotime($thatDay));
$Year = date('Y', strtotime($thatDay));
echo $day . ' ' . $Month . ' ' . $Year . '<BR>';
}
输出:
Monday, 1 04 2019
Tuesday, 2 04 2019
Wednesday, 3 04 2019
Thursday, 4 04 2019
Friday, 5 04 2019
...
...
如果您更改此行
$day = date('l, j', strtotime($thatDay));
至
$day = date('l, jS', strtotime($thatDay));
输出将是:2019年1月1日,星期一
- 3 回答
- 0 关注
- 124 浏览
添加回答
举报