开发者

PHP date and Zend_Date conversion?

开发者 https://www.devze.com 2023-02-12 02:42 出处:网络
I\'ve got this date : $date = \'Mon Feb 07 00:00:00 CST 2011\'; But I want $date to be formatted as 02-07-2011 only, using Zend framework or core 开发者_如何学Pythonphp also.<?php

I've got this date :

$date = 'Mon Feb 07 00:00:00 CST 2011';

But I want $date to be formatted as 02-07-2011 only, using Zend framework or core 开发者_如何学Pythonphp also.


<?php
$date = new DateTime('Mon Feb 07 00:00:00 CST 2011');

echo $date->format('m-d-Y');


$date='Mon Feb 07 00:00:00 CST 2011';
echo date('m-d-Y',strtotime($date));

Working example at http://codepad.org/gYfgYqED

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号