Home >Backend Development >PHP Tutorial >Mon Mar 12 10:18:26 +0800 2012 时间格式转换解决方法

Mon Mar 12 10:18:26 +0800 2012 时间格式转换解决方法

WBOY
WBOYOriginal
2016-06-13 10:15:131596browse

Mon Mar 12 10:18:26 +0800 2012 时间格式转换
上面的是个字符串,怎么把那个时间转换成2012-3-12 10:18:26格式 ,用php写的,谢谢啦

------解决方案--------------------
$s='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d H:i:s',strtotime($s));
------解决方案--------------------
好像可以直接用date转吧,忘记了

$str='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d G:i:s',strtotime($str));
------解决方案--------------------

探讨

$s='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d H:i:s',strtotime($s));

------解决方案--------------------
探讨

好像可以直接用date转吧,忘记了

$str='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d G:i:s',strtotime($str));
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