获取每月的最后一天

时间:2019-06-07 03:09:01

标签: php

我需要编写一个函数,该函数返回星期几是进行中月份的最后一天。我可以得到到目前为止的最后一天,但我不知道如何知道星期几。

1 个答案:

答案 0 :(得分:2)

$d = new DateTime('last day of this month');
echo $d->format('l'); //Sunday

特定月份\年份

$d = new DateTime('2019-07-07');
$d->modify('last day of this month');
echo $d->format('l'); //Wednesday
相关问题