title: Select entries between dates in doctrine 2
body: <p>I will go insane with this minimal error that I'm not getting fix. I want to select entries between two days, the examples below ilustrate all my fails:</p>
  
  <p><strong>opt 1.</strong></p>
  
  <pre><code>$qb-&gt;where('e.fecha &gt; ' . $monday-&gt;format('Y-m-d'));
  $qb-&gt;andWhere('e.fecha &lt; ' . $sunday-&gt;format('Y-m-d'));
  </code></pre>
  
  <p>result (0 entries):</p>
  
  <pre><code>SELECT r0_.id_reservacion AS id_reservacion0, r0_.fecha AS fecha1, r0_.cliente AS cliente2 
  FROM reservacion r0_ 
  WHERE (r0_.fecha &gt; 2012 - 07 - 16) AND (r0_.fecha &lt; 2012 - 07 - 22)
  </code></pre>
  
  <p><strong>opt 2</strong></p>
  
  <pre><code>$qb-&gt;add('where', 'e.fecha between 2012-01-01 and 2012-10-10');
  </code></pre>
  
  <p>result (0 entries):</p>
  
  <pre><code>SELECT r0_.id_reservacion AS id_reservacion0, r0_.fecha AS fecha1, r0_.cliente AS cliente2 
  FROM reservacion r0_ WHERE r0_.fecha 
  BETWEEN 2012 - 01 - 01 AND 2012 - 10 - 10
  </code></pre>
  
  <p>This is my table with current entries:</p>
  
  <pre><code>id      fecha            cliente
  1   2012-07-16 00:00:00    2    
  2   2012-07-16 13:00:00    4    
  3   2012-07-22 23:00:00    4
  </code></pre>
  
  <h2><strong>Edit 1</strong></h2>
  
  <p>In order to evaluate the sql to avoid doubts, I ran this query:</p>
  
  <pre><code>$qb-&gt;where('e.fecha &gt; ' . $sunday-&gt;format('Y-m-d'));
  </code></pre>
  
  <p>result (3 entries):</p>
  
  <pre><code>SELECT r0_.id_reservacion AS id_reservacion0, r0_.fecha AS fecha1, r0_.cliente AS cliente2 
  </code></pre>
  
  <p>So, looks like the sql is not the problem.
      FROM reservacion r0_ 
      WHERE r0_.fecha > 2012 - 07</p>