Php 得到月的最后一天
我需要写一个函数,返回一周中的哪一天是当前月份的最后一天。到目前为止,我可以知道最后一天,但我不知道如何知道这是一周中的哪一天Php 得到月的最后一天,php,Php,我需要写一个函数,返回一周中的哪一天是当前月份的最后一天。到目前为止,我可以知道最后一天,但我不知道如何知道这是一周中的哪一天 $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');
$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
这取决于您使用的日期函数。选中可以使用的日期格式选项()。例如myDate->format('t')将返回给定月份的天数。您可能使用date()来获取最后一天。你有没有看说明书上关于这个功能的内容?