0
考虑下面的PHP代码:PHP日期格式无法正常运行
$thestring = "Saturday - 05/10/2014 at 10:00 am";
echo $thestring."\n";
$thestring = str_replace("at ", "", $thestring);
echo $thestring."\n";
$thestring = substr($thestring, strpos($thestring, " - ")+3);
echo $thestring."\n";
$thedate = date_create_from_format("m/d/Y h:m a", $thestring);
echo $thedate->format("Ymd")."\n";
echo $thedate->format("Y")."\n";
echo $thedate->format("m")."\n";
echo $thedate->format("d")."\n";
为什么我会得到下面的输出?月份和年份关闭了,我没有看到它的合理解释。
Saturday - 05/10/2014 at 10:00 am
Saturday - 05/10/2014 10:00 am
05/10/2014 10:00 am
20131210
2013
12
10
我亲眼看见的。 PEBKAC。 –
@MattLachman由于大多数错误都会;) –