How can I get the difference between 2 dates in days, hours and minutes
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1968167/difference-between-dates-in-javascript">Difference between dates in JavaScript</a>  </p>
</blockquote>



<p>How can I get the difference between 2 dates in hours, minutes and seconds? This is my code which isn't working:</p>

<pre><code>var date = new Date(2012, 0, 21, 0, 0, 0, 0);

      window.setTimeout(function () {

          var now = new Date();
          console.log(now);
          console.log(date.getTime() - now.getTime());
          console.log(new Date(date - now));

      }, 1000);
</code></pre>

<p>None of the console.log show proper difference between 2 dates.</p>
