title: Compare two Time stamps in minutes JS
body: <p>Hi I'm using this timestamp:</p>
  
  <pre><code>function getTimeStamp() {
         var now = new Date();
         return ((now.getMonth() + 1) + '/' + (now.getDate()) + '/' + now.getFullYear() + " " + now.getHours() + ':'
                       + ((now.getMinutes() &lt; 10) ? ("0" + now.getMinutes()) : (now.getMinutes())) + ':' + ((now.getSeconds() &lt; 10) ? ("0" + now
                       .getSeconds()) : (now.getSeconds())));
  }
  </code></pre>
  
  <p>and saving pause time here:</p>
  
  <pre><code>localStorage["TmpPause"] = getTimeStamp();
  </code></pre>
  
  <p>than after a while read time and compare:</p>
  
  <pre><code>var pauseTime = localStorage["TmpPause"];
      var resumeTime = getTimeStamp();
  
      var difference = resumeTime.getTime() - pauseTime.getTime(); // This will give difference in milliseconds
      var resultInMinute = Math.round(difference / 60000);
  
      alert(resultInMinute);
  </code></pre>
  
  <p>at the moment I'm unable to calculate the difference in between 2 dates including time. I'm getting error undefined is not a function resumeTime.getTime() ???</p>
  
  <p>Thanks for your help. </p>