title: Format Date while fetching the result of query
body: <p>Ok, here is another one: I want to get the output from a mysql-query in a specific date format. Unfortunatley my code does not work. It must have something to do with "->format()", since without it I get the expected result. What am I doing wrong?</p>
  
  <pre><code>$sql = "
      SELECT 
          something,
          date
      FROM 
          table
      ";
  
  $querynav = mysql_query($sql);
  
  while($row = mysql_fetch_assoc($querynav)){
  
      $answer[] = array(
          'something' =&gt; $row['something'],
          'date' =&gt; (new DateTime($row['date']))-&gt;format('d.m.Y')
          );
  
  }
  </code></pre>