我在字符串函数新的,所以我需要一个复杂的SUBSTR和装饰功能,该字符串:字符串DateTime对象
Wed, 28 Dec 2011 13:04:30 GMT
字符串来我总是与这种格式。我想将它转换为DateTime对象。任何人都可以帮助我?
我在字符串函数新的,所以我需要一个复杂的SUBSTR和装饰功能,该字符串:字符串DateTime对象
Wed, 28 Dec 2011 13:04:30 GMT
字符串来我总是与这种格式。我想将它转换为DateTime对象。任何人都可以帮助我?
<?php
$date = new DateTime('Wed, 28 Dec 2011 13:04:30 GMT');
echo $date->format('r');
...打印:
Wed, 28 Dec 2011 13:04:30 +0000
你尝试过这个'$时间=的strtotime($日期);' – Dotnet 2011-12-28 13:22:39
为什么你就不能使用日期时间:: createfromformat() - http://php.net/manual/en/datetime.createfromformat.php? – 2011-12-28 13:22:50
strtotime函数不接受这种格式。 datetime :: createfromformat也许可以解决这种情况。谢谢你的帮助,我现在要去看看。 – MAB 2011-12-28 13:25:58