title: Zend_Db and Date Based Queries
body: <p>I'm using Zend_Db to query a table.  I have some <code>WHERE</code> clauses that need to be dates and it's not clear (at first glance) how to do this "the right way". Does Zend_Db provide an abstraction so I don't need to concern myself with how the backend (Oracle, MySQL, etc.) expects its dates?  Or do I need to format things in the way my backend expects them.</p>
  
  <p>I'm trying the following with an Oracle based database (PO_DATE is a timestamp field) </p>
  
  <pre><code>$table = $this-&gt;getDbTable();               
  $select = $table-&gt;select()-&gt;where('1 = ?', 1);      
  $select-&gt;where('PO_DATE = ?', '2009-12-02');
  </code></pre>
  
  <p>and I get the following exception</p>
  
  <pre><code>  &lt;b&gt;Message:&lt;/b&gt; 1843 ORA-01843: not a valid month SELECT "TABLE_NAME".* FROM "SYSTEM"."TABLE_NAME" WHERE (1 = 1) AND (PO_DATE = *'2009-12-02')  &lt;/p&gt;
  </code></pre>
  
  <p>I realize I could do something like this</p>
  
  <pre><code>$date = new Zend_Db_Expr(
  "to_date('2009-12-02', 'YYYY-MM-DD')"
  );
  $select-&gt;where('PO_DATE = ?', $date);
  </code></pre>
  
  <p>but that ties me to Oracle's date based Expressions, which partially defeats the purpose of using a SQL abstraction layer.</p>
  
  <p>Is there a generic way to do date queries independent of the back-end implementation with Zend_Db?</p>