0
Vu le code PHP suivant:PHP Dateformat ne fonctionne pas comme prévu
$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";
Pourquoi suis-je recevoir la sortie ci-dessous? Le mois et l'année sont éteints et je ne vois pas d'explication logique à cela.
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
Je l'ai juste vu moi-même. PEBKAC. –
@MattLachman Comme la plupart des erreurs font;) –