title: Rails changing date formatting upon insertion into database
body: <p>I need to compare today's date, which is 'calculated' as today : </p>
  
  <pre><code> time=Time.now
   today=time.day.to_s+'/'+time.month.to_s+'/'+time.year.to_s
  </code></pre>
  
  <p>where today would look like: </p>
  
  <pre><code>"21/4/2015" 
  </code></pre>
  
  <p>But when that example today goes into the db, sqlite auto-formats it to look like: </p>
  
  <pre><code>2015-04-21
  </code></pre>
  
  <p>But, I need to check whether today (declared above) is equal to the attribute from the db (post conversion). This, invariably, returns false, because whilst they are the same thing, the strings aren't equal. This breaks the logic of my program.</p>
  
  <p>Is there a way to convert today (declared above) to the same format as what happens to it when it is put into the db? i.e preprocess it, so that the logic holds and the equality check would return true.</p>
  
  <p>i.e</p>
  
  <pre><code>today.someMethod==Model.date =&gt; true
  </code></pre>