title: How to search dates in PostgreSQL?
body: <p>I would like to compare a date entered in a search field (e.g., 04.07.2012) with a date from my table (a <code>datetime</code> column called <code>date</code>). However, I can't seem to get my SQL query straight. </p>
  
  <p>What I tried:</p>
  
  <pre><code>find(:all, :conditions =&gt; ['\'to_timestamp(date, \'DD Mon YYYY\')\' LIKE \'to_timestamp(?, \'DD Mon YYYY\')\'', '#{query}']) 
  </code></pre>
  
  <p>but it fails:</p>
  
  <pre><code>PG::Error: ERROR:  syntax error at or near "DD"
  LINE 1: ...s".* FROM "projects"  WHERE ('to_timestamp(date, 'DD Mon YYY...
                                                               ^
  : SELECT "pacients".* FROM "projects"  WHERE ('to_timestamp(date, 'DD Mon YYYY')' LIKE 'to_timestamp('#{query}', 'DD Mon YYYY')')
  </code></pre>
  
  <p>I'm a real novice as far as (postgre)SQL is concerned and I would really appreciate some hints in the right direction of writing this query. </p>
  
  <p>Thanks a million! </p>