Reputation: 1391
Tue Oct 26 10:39:39 +0000 2010
How to convert format to 2010-10-26
Upvotes: 4
Views: 106
Reputation: 48284
Using the DateTime object:
echo date_format(new DateTime('Tue Oct 26 10:39:39 +0000 2010'), 'Y-m-d');
or:
$date = new DateTime('Tue Oct 26 10:39:39 +0000 2010');
echo $date->format('Y-m-d');
Upvotes: 0
Reputation: 35927
echo date('Y-m-d', strtotime("Tue Oct 26 10:39:39 +0000 2010"))
// 2010-10-26
Upvotes: 8