Reputation: 1488
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 php also.
Upvotes: 0
Views: 1846
Reputation: 8334
<?php
$date = new DateTime('Mon Feb 07 00:00:00 CST 2011');
echo $date->format('m-d-Y');
Upvotes: 5
Reputation: 86336
$date='Mon Feb 07 00:00:00 CST 2011';
echo date('m-d-Y',strtotime($date));
Working example at http://codepad.org/gYfgYqED
Upvotes: 4