2017-03-17 175 views

回答

0

一些期试验研究后,我发现了一个解决方案

str_replace('/', '-',$date) 
0
/* 
You got August because you provide wrong format to this function. Function accept m/d/y and you provide d/m/y. you can try with this format m/d/y 
or 
you can try this with DateTime object. 
*/ 
$date = "08/03/2017"; 
$dateObject = DateTime::createFromFormat('d/m/Y', $date); 
echo $dateObject->format('d M Y'); 
相关问题