21,886
社区成员
发帖
与我相关
我的任务
分享
$str='[28/Sep/2010:17:06:50';
$str=str_replace('/',' ',substr($str,1));
$str=preg_replace('/:/',' ',$str,1);
echo date('Y-m-d H:i:s',strtotime($str));
:
[
怎么去掉?
$d = '28/Sep/2010 17:06:50';
$d = str_replace('/',' ',$d);
echo $d;
echo '<br>';
echo date('Y-m-d H:i:s',strtotime($d));
//strtotime认识如下格式的时间字符串,你只需要将/,以及第一个:替换成空格就好了
strtotime('28 Oct 2010 17:06:50');