title: How to convert number to time format in javascript
body: <p>I am trying to convert the number <b>20</b> into minutes with moment js. I need </p>
  
  <pre><code>21 to to look like 21:00
  </code></pre>
  
  <p>This way for my set interval the timer will show 19:58   to 0:01.</p>
  
  <p>I had  tried</p>
  
  <pre><code>  var x = 1260000;
    var d = moment.duration(x, 'milliseconds');
    var hours = Math.floor(d.asHours());
    var mins = Math.floor(d.asMinutes()) - hours * 60;
  </code></pre>
  
  <p>This still leaves me with 21.   I am not sure how to get the minutes form.</p>
  
  <p>This seems like it shoud be a short fix.  Any help is greatly appreciated. </p>