title: Compare timestamp with date in sql
body: <p>Hi I am storing <code>date_added</code> with a timestamp in the database . </p>
  
  <p>Now a user wants to see particular transactions on a particular day so he enters the date which is in <code>2015-05-20</code> format and the one stored in table is <code>2015-05-20 13:01:01</code> format. 
   How can I fetch rows by only considering the date part in the table and not the time. 
  I have tried google and found <code>TO_CHAR</code> which didn't work for me. Also <a href="https://stackoverflow.com/questions/25910123/sql-compare-timestamp-with-normal-date">found this link on stackoverflow</a> but didn't work for me. </p>
  
  <p>This is my sql which I get when I die it in the model </p>
  
  <pre><code>SELECT * FROM `oc_return` r 
  LEFT JOIN oc_return_status rs 
  ON (r.return_status_id = rs.return_status_id) 
  WHERE r.organization_id = '4' 
  AND DATE(r.date_added) = DATE(2015-05-06) 
  ORDER BY r.return_id DESC LIMIT 0,30  
  </code></pre>
  
  <p>I manipulated the query by removing the <code>DATE()</code> and adding colons, removing them. Also when I there is an entry of it in the table and even when I remove organization_id from the query it shows up</p>
  
  <p>Wild card too didn't work for me. I tried converting to some other format but that too didn't work. I just want that when I fire Query by date it should only check the date part in table and ignore the time part. Please help. Thanks in advance for suggestions/help.</p>