Php 如何在DateTime中获取一周中的某一天?
如何在DateTime中获取一周中的某一天 我找不到从约会时间中获取一周中某一天的方法。 它可以是数字或字符串,两者都可以Php 如何在DateTime中获取一周中的某一天?,php,datetime,weekday,Php,Datetime,Weekday,如何在DateTime中获取一周中的某一天 我找不到从约会时间中获取一周中某一天的方法。 它可以是数字或字符串,两者都可以 $today = new DateTime("today"); echo $ today->//whatever to get Friday, Monday or 5, 0 如何在DateTime中获取一周中的某一天 编辑: 我使用的是DateTime,而不是date。您可以使用format()函数 参考这个[你知道,日期和日期时间不一样 $today->fo
$today = new DateTime("today");
echo $ today->//whatever to get Friday, Monday or 5, 0
如何在DateTime中获取一周中的某一天
编辑:
我使用的是DateTime,而不是date。您可以使用format()函数
参考这个[你知道,日期和日期时间不一样
$today->format('l') //Sunday through Saturday
$today->format('w') //0 (for Sunday) through 6 (for Saturday)