php strotime“;上周五2012年4月”;上周五不回来了
当我运行下面的代码时,我得到的是4月30日,而不是27日php strotime“;上周五2012年4月”;上周五不回来了,php,strtotime,Php,Strtotime,当我运行下面的代码时,我得到的是4月30日,而不是27日 strtotime("Last Friday April 2012"); 我试着把它当作一个星期四来运行,结果在29日就回来了 下面所有的工作都很好 strtotime("First Sunday February 2012"); strtotime("Third Monday February 2012"); strtotime("Second Monday October 2012"); strtotime("Fourth Thur
strtotime("Last Friday April 2012");
我试着把它当作一个星期四来运行,结果在29日就回来了
下面所有的工作都很好
strtotime("First Sunday February 2012");
strtotime("Third Monday February 2012");
strtotime("Second Monday October 2012");
strtotime("Fourth Thursday November 2012");
有什么想法吗?我相信你会在3月30日而不是4月30日回来,对吗
上周五2012年4月
执行以下操作:
将日期设置为2012-04-012012年4月
将日期移到上一(上)周五,即2012年3月30日上周五
2012年5月的最后一个星期五
请参阅PHP手册。您还可以使用:
strtotime("last friday of April 2012");
echo date( 'F jS, Y h:i:s A', strtotime("last friday of April 2012"));
这将输出所需的日期:
April 27th, 2012 12:00:00 AM
strotime是垃圾输入、垃圾输出的一个很好的例子——你的短语不够具体,所以strotime猜错了。