title: calculate time difference between two date in HH:MM:SS javascript
body: <p>I have created one timer application in javascript.
  Firstly it takes the current UTC date to init timer with some reference. here's the code</p>
  
  <pre><code>on_timer: function(e) {
              var self = this;
              if ($(e.target).hasClass("pt_timer_start")) {
                  var current_date = this.get_current_UTCDate();
                  this.project_timesheet_db.set_current_timer_activity({date: current_date});
                  this.start_interval();
                  this.initialize_timer();
                  this.$el.find(".pt_timer_start,.pt_timer_stop").toggleClass("o_hidden");
  </code></pre>
  
  <p>Now, Once timer is started and after some time span timer has some elapsed time with reference to above <code>on_timer: function(e)</code> function.</p>
  
  <p>This function is </p>
  
  <pre><code>start_interval: function() {
              var timer_activity = this.project_timesheet_db.get_current_timer_activity();
              var self = this;
              this.intervalTimer = setInterval(function(){
                  self.$el.find(".pt_duration").each(function() {
                      var el_hour = $(this).find("span.hours");
                      var el_minute = $(this).find("span.minutes");
                      var minute = parseInt(el_minute.text());
                      if(minute &gt;= 60) {
                          el_hour.text(_.str.sprintf("%02d", parseInt(el_hour.text()) + 1));
                          minute = 0;
                      }
                      el_minute.text(_.str.sprintf("%02d", minute));
                      var el_second = $(this).find("span.seconds");
                      var seconds = parseInt(el_second.text()) + 1;
                      if(seconds &gt; 60) {
                          el_minute.text(_.str.sprintf("%02d", parseInt(el_minute.text()) + 1));
                          seconds = 0;
                      }
                      el_second.text(_.str.sprintf("%02d", seconds));
                  });
              }, 1000);
          },
  </code></pre>
  
  <p>Now, considering <strong>el_hour</strong>, <strong>el_minute</strong>, <strong>el_seconds</strong> How to can i count time difference between init time and current timer value in HH:MM:SS manner.</p>
  
  <p>thanks in advance for help</p>