我想将30.10.2014 15\:25\:24
转换为30/Oct/2014 15:25:24
。我这样试过......
$s = '30.10.2014 15\:25\:24';
$date = strtotime($s);
echo date('d/M/Y H:i:s', $date);
...但我的结果是01.Jan.1970 01:00:00
答案 0 :(得分:0)
因为strtotime返回FALSE,代码如下所示
$s = '30.10.2014 15\:25\:24'; //invalid format
$date = strtotime($s);
if($date===FALSE) //if strtotime failed
{
echo "strtotime failed";
}