Answer the question
In order to leave comments, you need to log in
Pure mathematics. How to get seconds, minutes, hours from milliseconds?
html5 video player. I want to display seconds minutes and hours
video.duration // общая длительность ролика в миллисекундах
video.currentTime // текущее время ролика в миллисекундах
Answer the question
In order to leave comments, you need to log in
Something like this
function time2str(time) {
if(!time || typeof time != "number" || time < 0) {
return "00:00:00";
}
var m = new Date(time * 1000).toISOString().match(/\d\d:\d\d:\d\d/);
return m ? m[0].split(":").slice(0, 3).join(":") : "00:00:00";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question