title: Calculate total seconds in PHP DateInterval
body: <p>What is the best way to calculate the total number of seconds between two dates?  So far, I've tried something along the lines of: </p>
  
  <pre><code>$delta   = $date-&gt;diff(new DateTime('now'));
  $seconds = $delta-&gt;days * 60 * 60 * 24;
  </code></pre>
  
  <p>However, the <code>days</code> property of the DateInterval object seems to be broken in the current PHP5.3 build (at least on Windows, it always returns the same <code>6015</code> value).  I also attempted to do it in a way which would fail to preserve number of days in each month (rounds to 30), leap years, etc:</p>
  
  <pre><code>$seconds = ($delta-&gt;s)
           + ($delta-&gt;i * 60)
           + ($delta-&gt;h * 60 * 60)
           + ($delta-&gt;d * 60 * 60 * 24)
           + ($delta-&gt;m * 60 * 60 * 24 * 30)
           + ($delta-&gt;y * 60 * 60 * 24 * 365);
  </code></pre>
  
  <p>But I'm really not happy with using this half-assed solution.  </p>