Getting first weekday in a month with strtotime

前端 未结 6 1437
情深已故
情深已故 2020-12-03 21:52

I\'m trying to figure out the first wednesday of a given month using strtotime, but the \"first wednesday\" argument fails whenever the first wednesday happens

6条回答
  •  被撕碎了的回忆
    2020-12-03 22:35

    PHP 5.5.11

    $firstWeekdayOfMonth = new DateTime('first weekday 0 jun 2016');

    I don't know why, but the zero kind of force the strtotime parser to start at the beginning of the month considering the first day.

提交回复
热议问题