title: symfony doctrine type datetime expected format y-m-d h:i:s
body: <p>I have a problem in symfony when I try to select some items from database with doctrine.</p>
  
  <p>I run this: </p>
  
  <pre><code>$allOrders = $em-&gt;getRepository('MyBundle:Dieta')-&gt;findBy(array('diet_status'=&gt;'active'));
  var_dump($allOrders);
  </code></pre>
  
  <p>And I get the following error:</p>
  
  <blockquote>
    <p>Could not convert database value "2014-03-03" to Doctrine Type
    datetime. Expected format: Y-m-d H:i:s</p>
  </blockquote>
  
  <p>When I insert the date in the database i do it like this: </p>
  
  <pre><code>$format = 'd/m/Y';
  $date = \DateTime::createFromFormat($format, $_POST['dietStartDate']);
  $dietStartDate = $date-&gt;format('Y-m-d H:i:s');
  $dietStartDate = new \Datetime($dietStartDate);
  
  $timestamp = strtotime(str_replace('/', '-', $_POST['dietStartDate']));
  $timestamp7 = strtotime('+7 days', $timestamp);
  $datetime = date("Y-m-d H:i:s", $timestamp7);
  $dietDateEnd = new \Datetime($datetime);
  </code></pre>
  
  <p>The <code>$dietStartDate</code> and <code>$dietDateEnd</code> are inserted in a datetime column in database. In the doctrine.yml I have it also declared as datetime.</p>
  
  <p>Any ideas ? </p>