james
james

Reputation: 1

Convert date in php

How to convert "Thu Oct 28 16:33:29 +0000 2010 " to like "Oct 28,2010 at 10:33PM"

Upvotes: 0

Views: 72

Answers (2)

Marc B
Marc B

Reputation: 360912

$date = DateTime::createFromFormat('Thu Oct 28 16:33:29 +0000 2010', 'D M j h:m:s O Y');
echo $date->format('M d,Y, h:mA');

Relevant docs here

Upvotes: 1

Ken Richards
Ken Richards

Reputation: 3021

Use the strtotime function combined with the date function

echo date("jS F, Y", strtotime("11/25/10"));
// outputs 25th November, 2010 

Upvotes: 7

Related Questions