title: Rails calculate time difference
body: <p>I have tried such code, but it doesn't work:</p>
  
  <pre><code>require 'time_diff'
  
  cur_time = Time.now.strftime('%Y-%m-%d %H:%M')
  time_diff_components = Time.diff(@art.datetime_of_update, Time.parse(cur_time))
  if  @art.PRICEM.to_f &gt;= eprice.to_f || @art.PRICEM.blank? &amp;&amp; time_diff_components[:hour] &lt; 3 &amp;&amp;
  </code></pre>
  
  <p>but timediff is 0, in db time looks like this:</p>
  
  <blockquote>
    <p>2012-08-28 19:53:12</p>
  </blockquote>
  
  <p>How calculate difference in hour's between now and db? </p>