看起来 PHP 的 strtotime 函数从其结果中排除了新年。有没有办法强制 strtotime 包含它?其他假期如劳动节似乎没有这个问题(见下面的第3个代码示例)。
谢谢!
// The 1st Wed in Jan 2020 falls on New Year's Day
// But we get: "Wed 2020-01-08" (INCORRECT... it should return "Wed 2020-01-01")
echo date("D Y-m-d", strtotime("First Wednesday " . "2020-01"));
// However, asking for the 1st Thu in Jan 2020 returns the correct result: "Thu 2020-01-02"
echo date("D Y-m-d", strtotime("First Thursday " . "2020-01"));
// Even asking for the 1st Mon in Sep 2020, which is Labor Day returns the correct result: "Mon 2020-09-07"
echo date("D Y-m-d", strtotime("First Monday " . "2020-09"));
红颜莎娜
扬帆大鱼