[28/Sep/2010:17:06:50这种格式怎么转成2010-10-28 17:06:50

解决方案 »

  1.   


    //strtotime认识如下格式的时间字符串,你只需要将/,以及第一个:替换成空格就好了
    strtotime('28 Oct 2010 17:06:50');
      

  2.   

    $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));
      

  3.   

    纯粹实现的话。。
    $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));