0 Replies Latest reply on Aug 19, 2015 6:53 AM by adolfj84385943

    how to count down time 00:00 fomat

    adolfj84385943

      how to count down like

      00:60

      00:59

      00:58

       

       

      var formatSeconds = function(secs){

          var pad = function(n) {

              return (n < 10 ? "0" + n : n);

          };

       

          var h = Math.floor(secs / 3600);

          var m = Math.floor((secs / 3600) % 1 * 60); // Remainder of an hour of seconds x 60

          var s = Math.floor((secs / 60) % 1 * 60); // Remainder of a minute of seconds x 60

       

          return pad(h) +":"+ pad(m) +":"+ pad(s);

      };

       

       

      var counter = setInterval(timer, 500);

       

       

      s = formatSeconds(60);

       

       

       

      function timer() {

       

      s--;

       

      sym.$("Text").html(s); //return Nan error

       

       

      }

       

       

      thx