PHP strtotime() “first monday february” returns second monday if february 1st is a monday

后端 未结 2 408
栀梦
栀梦 2020-12-07 02:20

I\'m working on a PHP function which calculates holidays:

function holidays($country = 1, $timespan_start = 0, $timespan_end = 0)

The holid

2条回答
  •  隐瞒了意图╮
    2020-12-07 02:43

    Looks like you are just missing an "of":

    echo date('Y-m-d', strtotime('first monday of february 2010'));
    

    will give the expected result. See the PHP Manual on Relative dates for the various input formats.

提交回复
热议问题