Karthik
Karthik

Reputation: 1488

PHP date and Zend_Date conversion?

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

Answers (2)

Jacob
Jacob

Reputation: 8334

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

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

Upvotes: 5

Shakti Singh
Shakti Singh

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

Related Questions