title: convert seconds to time format javascript
body: <p><strong>Javascript function</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;                          
        var MAX_COUNTER = 100;
      var counter = null;
      var counter_interval = null;
  
      function updateCounter() {
          var msg = '';
          if (counter &gt; 0) {
              counter -= 1;
              msg = counter;
              setCookie('counter', counter, 1);
          }
          else {
              msg = "Counting finished.";
              stopCounter();
          }
          var el = document.getElementById('counter');
          if (el) {
              el.innerHTML = msg;
          }
      }
      function resetCounter() {
          counter = MAX_COUNTER;
      }
      function stopCounter() {
          window.clearInterval(counter_interval);
          deleteCookie('counter');
      }
      function startCounter() {
          stopCounter();
          counter_interval = window.setInterval(updateCounter, 1000);
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>I have this function to make a countdown timer..it output the number depends on what i put on the MAX_COUNTER..but i want to convert it to hh:mm:ss ...since im a newbie in javascript. how to convert it to hh:mm:ss format? plss help..:(</p>