200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > php 统计一个月工作日 php – 使用strtotime在一个月内获得第一个工作日

php 统计一个月工作日 php – 使用strtotime在一个月内获得第一个工作日

时间:2023-02-10 11:35:53

相关推荐

php 统计一个月工作日 php – 使用strtotime在一个月内获得第一个工作日

我想使用strtotime找出一个特定月份的第一个星期三,但是第一个星期三发生在第一个星期三的时候,“第一个星期三”的参数就会失败.

有关此问题的更一般说明,请参阅以下代码和结果:

$mon = strtotime("December first monday");

$tue = strtotime("December first tuesday");

$wed = strtotime("December first wednesday");

$thu = strtotime("December first thursday");

$fri = strtotime("December first friday");

$sat = strtotime("December first saturday");

$sun = strtotime("December first sunday");

echo strftime("%m/%d/%y", $mon) . "

";

echo strftime("%m/%d/%y", $tue) . "

";

echo strftime("%m/%d/%y", $wed) . "

";

echo strftime("%m/%d/%y", $thu) . "

";

echo strftime("%m/%d/%y", $fri) . "

";

echo strftime("%m/%d/%y", $sat) . "

";

echo strftime("%m/%d/%y", $sun) . "

";

结果是:

12/06/10

12/07/10

12/08/10

12/02/10

12/03/10

12/04/10

12/05/10

注意事项本周的一天不应与本月1日相符?但是它从来没有,而是在第八天的第二天,总是回归.

有人有解释吗?

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。