Home  >  Article  >  Backend Development  >  apache日志中的日期格式怎么转换成mysql中的datetime

apache日志中的日期格式怎么转换成mysql中的datetime

WBOY
WBOYOriginal
2016-06-13 13:35:591019browse

apache日志中的日期格式如何转换成mysql中的datetime
需要添加apache log记录中的日期到数据库中,数据库字段类型为datetime,如何转换下面的字符串到日期格式?

15/Apr/2012:23:54:05 -0700


转换成不带时区的datetime格式,时区转换成UTC时间。

------解决方案--------------------

PHP code
echo date('Y-m-d H:i:s', strtotime('15/Apr/2012:23:54:05 -0700')); //2012-04-16 02:54:05 <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn