Created
June 30, 2015 07:30
-
-
Save jdelStrother/a2dfadfa9ee9ad6f54ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function secondsToHoursMinutesSeconds(totalSec) { | |
| totalSec = Math.round(totalSec) | |
| var hours = Math.floor(totalSec / 3600) % 24 | |
| totalSec -= hours * 3600 | |
| var minutes = Math.floor(totalSec / 60) % 60 | |
| totalSec -= minutes * 60 | |
| return padToTwo(hours) + ':' + padToTwo(minutes) + ':' + padToTwo(totalSec) | |
| } | |
| // 3000 -> "50:00" | |
| function formatTime(time) { | |
| var hours = Math.floor(time / 3600) | |
| var minutes = Math.floor(time / 60) % 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment