1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 10:49:36 +02:00
This commit is contained in:
Daniel Neto 2023-10-20 12:49:45 -03:00
parent 8c27070d24
commit 3b74f82d4b
5 changed files with 46 additions and 18 deletions

View file

@ -4035,4 +4035,21 @@ function randomColor() {
var g = Math.floor(Math.random() * 255);
var b = Math.floor(Math.random() * 255);
return r + "," + g + "," + b;
}
}
function secondsToTime(sec) {
var rest = parseInt((sec % 1) * 100);
var date = new Date(null);
date.setSeconds(sec); // specify value for SECONDS here
var timeString = date.toISOString().substr(11, 8);
return (timeString + '.' + rest);
}
function timeToSeconds(hms) {
var a = hms.split(':'); // split it at the colons
// minutes are worth 60 seconds. Hours are worth 60 minutes.
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
return (seconds);
}