从strtotime中排除周末



我只想在这个片段中显示工作日(周一、周二、周三、周四、周五):u2028u2028<?=date('D M, d', strtotime('+3 days'))?>



我很难知道在StackOverflow中搜索什么。我搜索"根据工作日计算未来日期"或"检查日期是否为周末PHP"并没有得到我所能理解的结果。

用例:作为一名客户,我想知道我多久能收到服务。此代码将显示我何时可以获得服务,工作日3天(即使在节假日)。

我发现了这个,http://php.net/manual/en/intlcalendar.getdayofweektype.php但我仍然被卡住了:(

如果你只想要工作日,那么strtotime可以做到这一点。

date('D M, d', strtotime('+3 weekdays'))

相对日期/时间格式:http://www.php.net/manual/en/datetime.formats.relative.php

最新更新