pojin (ID: 1)
头衔:论坛坛主
等级:究级天王[荣誉]
积分:1301
发帖:99 篇
来自:保密
注册:2022-08-28 23:20:57
造访:2025-03-23 21:18:24
发帖:99 篇
来自:保密
注册:2022-08-28 23:20:57
造访:2025-03-23 21:18:24
[ 第 1 楼 ]
回复

例如 : 时间戳改为00:00
function FormatTime (t){
let m = parseInt((t % 3600) / 60);
m = m < 10 ? '0' + m : m;
let s = parseInt(t % 60);
s = s < 10 ? '0' + s : s;
return m + ':' + s;
};
例如 : 00:00还原成时间戳
function MakeDurationToSeconds(time){
let str = time;
let arr = str.split(':');
let ms = parseInt(arr[0] * 60);
let ss = parseInt(arr[1]);
let seconds = ms + ss;
return seconds;
};
function FormatTime (t){
let m = parseInt((t % 3600) / 60);
m = m < 10 ? '0' + m : m;
let s = parseInt(t % 60);
s = s < 10 ? '0' + s : s;
return m + ':' + s;
};
例如 : 00:00还原成时间戳
function MakeDurationToSeconds(time){
let str = time;
let arr = str.split(':');
let ms = parseInt(arr[0] * 60);
let ss = parseInt(arr[1]);
let seconds = ms + ss;
return seconds;
};

