Guest User

Untitled

a guest
Mar 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. secondsToHourMinuteSecond(totalSeconds) {
  2. let hour = Math.floor(totalSeconds / 3600);
  3. let minute = Math.floor(totalSeconds % 3600 / 60);
  4. let seconds = Math.floor(totalSeconds % 3600 % 60);
  5.  
  6. return `${('0' + hour).slice(-2)}:${('0' + minute).slice(-2)}:${('0' + seconds).slice(-2)}`
  7. }
  8.  
  9. /*
  10. returns total seconds to hh:mm:ss value.
  11. e.g. 133 seconds = 00:02:13
  12. */
Add Comment
Please, Sign In to add comment