title: Date difference in RoR 3
body: <p>I have 2 dates that is <code>2011-03-01 00:00:00 UTC</code> and <code>2011-03-31 00:00:00 UTC</code>. When I try to get days between them it returns <code>2592000.0</code> Days. Why? It should be 30 days?</p>
  
  <p>To get days between dates I use <code>-</code> like <code>date1 - date2</code>. How can I get correct difference?</p>
  
  <p>My environment is Ruby 1.8.7 with Rails 3.0.3.</p>
  
  <hr>
  
  <p>I retrieve data from db and then do like following:</p>
  
  <pre><code>//--some html code
  &lt;td&gt;
  &lt;%@data.each do |data|%&gt;
     &lt;%=(@data.date1 - @data.date2).to_i%&gt;
  &lt;%end%&gt;
  &lt;/td&gt;
  //--some html code
  </code></pre>
  
  <p>The datatype in db is <code>DateTime</code>.</p>