I'm trying to write a logic to convert seconds to the following formats:
- HH:MM:SS:MS, where MS is milliseconds
- HH:MM:SS;F, where F are the frames
(and not just to HH:MM:SS, therefore this question is different from the others on Stackoverflow)
I have the following logic for getting the HH:MM:SS format currently:
getTime(seconds) {
let h = Math.floor(seconds / 3600);
seconds = seconds % 3600;
let min = Math.floor(seconds / 60);
seconds = Math.floor(seconds % 60);
if (seconds.toString().length < 2) seconds = "0" + seconds;
if (min.toString().length < 2) min = "0" + min;
return (h + ":" + min + ":" + seconds);
}
but how can I get milliseconds or frames?