爲什麼爲什麼<?php回聲日期(「m/d/Y」strtotime('second wednesday June 2016'))?> output 6/15/2016而不是2016/6/8/2016?
<?php echo date("m/d/Y" strtotime('second Wednesday June-2016')) ?>
輸出2016年6月15日,而不是2016年6月8日?
這大約是我想出來的---不是很雄辯的工作:
<?php
months = array(1=>'Jan',2=>'Feb',3=>'Mar',4=>'Apr',5=>'May',6=>'Jun',7=>'Jul',8=>'Aug',9=>'Sep',10=>'Oct',11=>'Nov',12=>'Dec');
$year = "2016";
$month = "06";
$smonth=$months[(int)$month];
$tstr=$month."/01/".$year;
$dow=date("D",strtotime($tstr));
if ($dow == "Wed") {
$nstr="first";
} else {
$nstr="Second";
}
$edate= date("m/d/Y", strtotime($nstr.' Wednesday '.$smonth.'-'.$year));
echo $edate."<br>";
?>
而不是'second'嘗試使用'2' –