找出每个月的第n个星期的日期(例如,找出下个月的第二个星期的星期五知道这个月的第二个星期是星期五)


Find the day of every nth week of a month (e.g. find Friday of second week of next month knowing Friday the second week of this month)

如何查找一个月的第n周中的星期几。

例子:今天(10日)是8月的第三周,14日是9月的第三周,也是周日。我怎么知道9月14日是8月10日?

您可以使用strtotime()。http://php.net/manual/en/function.strtotime.php

和相对日期格式。http://php.net/manual/en/datetime.formats.relative.php

date('Y-m-d', strtotime('first Sunday of September')); //2014-09-07
date('Y-m-d', strtotime('second Sunday of September')); //2014-09-14
date('Y-m-d', strtotime('third Sunday of September')); //2014-09-21