Maarten Hartman
Maarten Hartman

Reputation: 1629

PHP date/time format, need some assistance

can you please help me with formatting the following date using PHP

variable $start contains the following date

this date

Wed Feb 01 2012 05:00:00 GMT-080

should become

2012-02-01T13:00:00

I know how to use basic PHP date/time formats, but this one is a bit though-er,

thanks in advance

Upvotes: 0

Views: 468

Answers (2)

user895378
user895378

Reputation:

$d = new \DateTime('Wed Feb 01 2012 05:00:00 GMT-080');
echo $d->format('Y-m-d\TH:i:s');

Upvotes: 2

deceze
deceze

Reputation: 522616

echo date('Y-m-d\TH:i:s', strtotime('Wed Feb 01 2012 05:00:00 GMT-0800'));

Upvotes: 2

Related Questions