问题描述
- javasrcipt 计算时间差到毫秒。
-
1
00:00:13,170 --> 00:00:16,560 //这是字幕里的文件
wheeler introducing
2
00:00:16,560 --> 00:00:29,180
results survival from 7-11 only on ECG
hasn't decided whether he goes in想计算每条字幕显示的时间
解决方案
var t1 = "00:00:13,170";
var t2 = "00:00:16,560";
var间隔毫秒数 = parseInt(t2.split(",")[0].split(",")[0]) * 3600000 +
parseInt(t2.split(",")[0].split(",")[1]) * 60000 +
parseInt(t2.split(",")[0].split(",")[2]) * 1000 +
parseInt(t2.split(",")[1]) -
parseInt(t1.split(",")[0].split(",")[0]) * 3600000 +
parseInt(t1.split(",")[0].split(",")[1]) * 60000 +
parseInt(t1.split(",")[0].split(",")[2]) * 1000 +
parseInt(t1.split(",")[1]);
解决方案二:
转换成秒就除以1000
解决方案三:
转换成时间戳的话更方便处理
时间: 2024-10-26 18:59:02