Skip to content

Instantly share code, notes, and snippets.

@muhfaris
Created April 9, 2018 03:52
Show Gist options
  • Select an option

  • Save muhfaris/5ffcfd283e1f2d9500d2e3b98d3378a6 to your computer and use it in GitHub Desktop.

Select an option

Save muhfaris/5ffcfd283e1f2d9500d2e3b98d3378a6 to your computer and use it in GitHub Desktop.

Revisions

  1. muhfaris created this gist Apr 9, 2018.
    11 changes: 11 additions & 0 deletions convertMS.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    function convertMS(ms) {
    var d, h, m, s;
    s = Math.floor(ms / 1000);
    m = Math.floor(s / 60);
    s = s % 60;
    h = Math.floor(m / 60);
    m = m % 60;
    d = Math.floor(h / 24);
    h = h % 24;
    return { d: d, h: h, m: m, s: s };
    };