Paypal IPN return datetime formatting

ε祈祈猫儿з 提交于 2019-12-13 01:50:48

问题


Palpal sandbox IPN returning datetime as Mon Jun 15 2015 12:04:00 GMT+0600 (Azores Standard Time). How to format this in PHP? Please look at my date format. This is not duplicate.


回答1:


If you remove (Azores Standard Time) your date will become valid, and then you can use strtotime() or DateTime:

$string = 'Mon Jun 15 2015 12:04:00 GMT+0600 (Azores Standard Time)';
$string = substr($string, 0, strrpos($string, '(') - 1);
$dt = new DateTime($string);
echo $dt->format('c \o\r U');

demo



来源:https://stackoverflow.com/questions/30838667/paypal-ipn-return-datetime-formatting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!