title: Convert ISO 8601 Date format string to PHP date format
body: <p>I have a ISO date format string, <code>MMM d, y h:mm:ss a</code> for example. How do I convert it to the format acceptable by php <code>date</code> funtion? I want this as a result: <code>M j, y g:i:s A</code>.</p>
  
  <p>Zend framework has a method to convert php format to iso:</p>
  
  <pre><code>public static function convertPhpToIsoFormat($format)
  {
      if ($format === null) {
          return null;
      }
  
      $convert = array('d' =&gt; 'dd'  , 'D' =&gt; 'EE'  , 'j' =&gt; 'd'   , 'l' =&gt; 'EEEE', 'N' =&gt; 'eee' , 'S' =&gt; 'SS'  ,
                       'w' =&gt; 'e'   , 'z' =&gt; 'D'   , 'W' =&gt; 'ww'  , 'F' =&gt; 'MMMM', 'm' =&gt; 'MM'  , 'M' =&gt; 'MMM' ,
                       'n' =&gt; 'M'   , 't' =&gt; 'ddd' , 'L' =&gt; 'l'   , 'o' =&gt; 'YYYY', 'Y' =&gt; 'yyyy', 'y' =&gt; 'yy'  ,
                       'a' =&gt; 'a'   , 'A' =&gt; 'a'   , 'B' =&gt; 'B'   , 'g' =&gt; 'h'   , 'G' =&gt; 'H'   , 'h' =&gt; 'hh'  ,
                       'H' =&gt; 'HH'  , 'i' =&gt; 'mm'  , 's' =&gt; 'ss'  , 'e' =&gt; 'zzzz', 'I' =&gt; 'I'   , 'O' =&gt; 'Z'   ,
                       'P' =&gt; 'ZZZZ', 'T' =&gt; 'z'   , 'Z' =&gt; 'X'   , 'c' =&gt; 'yyyy-MM-ddTHH:mm:ssZZZZ',
                       'r' =&gt; 'r'   , 'U' =&gt; 'U');
      $values = str_split($format);
      foreach ($values as $key =&gt; $value) {
          if (isset($convert[$value]) === true) {
              $values[$key] = $convert[$value];
          }
      }
  
      return implode($values);
  }
  </code></pre>
  
  <p>I want to convert the output of this method back to a php date format.</p>