Home >Backend Development >PHP Tutorial >php 日期格式转换疑点,望大神伸手。

php 日期格式转换疑点,望大神伸手。

WBOY
WBOYOriginal
2016-06-13 12:00:09974browse

php 日期格式转换疑问,望大神伸手。。
MSSQL数据库里存的时间为:2013-06-28 00:00:00

PHP输入后格式为:06 28 2013 12:00AM

我用的方法是:date("Y-m-d日",strtotime($rs1['DJRQ']))     说明:$rs1['DJRQ'] = 06 28 2013 12:00AM

得到的结果是:1970-01-01

我想要的格式是:2013-6-28 或 2013-06-28 该如何解决呢?望高手指点。。
------解决方案--------------------

echo date('Y-m-d H:i:s', strtotime(preg_replace('/ /', '/', '06 28 2013 12:00AM', 2)));
2013-06-28 00:00:00

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