title: How do I subtract hour in javascript?
body: <p>I get the result below.</p>
  
  <pre class="lang-js prettyprint-override"><code>data[11] = "12:05:00";
  data[10] = "02:00:00";
  </code></pre>
  
  <p>I want to subtract date[11] and date[10] so it will return '10 hours 5 minutes' value to my other variable and using javascript.</p>
  
  <p>So far, I've tried this code:</p>
  
  <pre class="lang-js prettyprint-override"><code>function getAct(data, s) {
  
    var startTime = data[10];
    var endTime = data[11];
  
    var s = startTime.split(':');
    var e = endTime.split(':');
  
    var end = new Date(0, 0, 0, parseInt(e[1], 10), parseInt(e[0], 10), 0);
    var start = new Date(0, 0, 0, parseInt(s[1], 10), parseInt(s[0], 10), 0);
  
    var elapsedMs = end - start;
    var elapsedMinutes = elapsedMs / 1000 / 60;
  
    return elapsedMinutes;
  
  }
  </code></pre>
  
  <p>I get only minutes from the result and the result is incorrect.</p>