How do I convert an ISO8601 date to another format in PHP?

A fast but sometimes-unreliable solution:

$date="2011-09-02T18:00:00";

$time = strtotime($date);

$fixed = date('l, F jS Y \a\t g:ia', $time); // 'a' and 't' are escaped as they are a format char.

Format characters detailed here.

Leave a Comment