Created
October 27, 2025 21:33
-
-
Save drteresavasquez/2c10dd83ee4004a2b8128792adff7b56 to your computer and use it in GitHub Desktop.
formatTime.js
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 formatTime(ms) { | |
| const totalSeconds = Math.floor(ms / 1000); | |
| const hours = String(Math.floor(totalSeconds / 3600)).padStart(2, '0'); | |
| const minutes = String(Math.floor((totalSeconds % 3600) / 60)).padStart(2, '0'); | |
| const seconds = String(totalSeconds % 60).padStart(2, '0'); | |
| return `${hours}:${minutes}:${seconds}`; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment