title: Time remaining to the next 5 minutes - Javascript
body: <p>I am trying to display the time remaining for the next 5 minutes (snapped to the full 5 minutes of the current time e.g., 15:05, 15:10..)</p>
  
  <p>I was able to achieve the same for the time remaining for next Hour (Not minutes):</p>
  
  <pre><code>&lt;span class="timer"&gt;&lt;/span&gt;
  &lt;script&gt;
  function secondPassed() {
      var cur_date = new Date();
      var hour = cur_date.getHours();
      var minutes = cur_date.getMinutes();
      var seconds = cur_date.getSeconds();
      var minutes_remain = parseInt(59 - parseInt(minutes));
      var seconds_remain = parseInt(60 - parseInt(seconds));
  
      var timers = document.getElementsByClassName('timer');
      for (var i = 0; i &lt; timers.length; i++) {
          timers[i].innerHTML = minutes_remain+":"+seconds_remain;
      }
  
  }
  
  var countdownTimer = setInterval(secondPassed, 1000);
  &lt;/script&gt;
  </code></pre>
  
  <p>JSfiddle : <a href="http://jsfiddle.net/ov0oo5f7/" rel="noreferrer">http://jsfiddle.net/ov0oo5f7/</a></p>