title: PHP DateTime: Failed to parse time string
body: <p>I've looked at other questions about the same error but I'm having trouble applying them to my situation. </p>
  
  <p>This is the error I'm getting:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'Exception' with message
    'DateTime::__construct() [datetime.--construct]: Failed to parse
    time string (2013-07-22164:50:00) at position 10 (1): Unexpected
    character' in
    /Applications/XAMPP/xamppfiles/htdocs/Festival_Planner/index.php:88
    Stack trace: #0
    /Applications/XAMPP/xamppfiles/htdocs/Festival_Planner/index.php(88):
    DateTime->__construct('2013-07-22164:5...', Object(DateTimeZone)) #1
    {main} thrown in
    /Applications/XAMPP/xamppfiles/htdocs/Festival_Planner/index.php on
    line 88</p>
  </blockquote>
  
  <p>This is the for loop with the line that's generating the error:</p>
  
  <pre><code>    for($iCount2=0;$iCount2&lt;count($ascreenings);$iCount2++){
      $ocurrentscreening = $ascreenings[$iCount2];
  
      ///////// THIS IS LINE 88:
      $time = new DateTime($ocurrentscreening-&gt;date.''.$ocurrentscreening-&gt;starttime,new DateTimeZone('Pacific/Auckland'));
      $displayTime = date_format($time, 'g:ia');
  
      $sLabel =  $ocurrentscreening-&gt;date.', '.$displayTime.'.';
      $oForm-&gt;makeCheckBox("screening".$ocurrentscreening-&gt;screeningid, $sLabel, $ocurrentscreening-&gt;screeningid);
          }   
  </code></pre>
  
  <p>And this is a similar for loop that DOES work, using exactly the same code structure as I did on line 88.</p>
  
  <pre><code>    for($iCount=0;$iCount&lt;count($aUsersScreenings);$iCount++){
          $odisplayedscreening = $aUsersScreenings[$iCount];
  
          $ofilm = new film();
          $ofilm-&gt;load($odisplayedscreening-&gt;filmid);
  
          $title = $ofilm-&gt;title;
  
          $time = new DateTime($odisplayedscreening-&gt;date.''.$odisplayedscreening-&gt;starttime,new DateTimeZone('Pacific/Auckland'));
          $displayTime = date_format($time, 'g:ia');
  
          $sHTML .= '
          &lt;div class="selected" id="screening'.$odisplayedscreening-&gt;screeningid.'"&gt; 
          &lt;span&gt;'.$title.'&lt;/span&gt;.'.$displayTime.'.
          &lt;/div&gt;
          ';
          }
  </code></pre>