Jor*_*lla 11
使用split和multiply每60忽略秒.
以这个答案为基础:
var hms = '02:04:33'; // your input string
var a = hms.split(':'); // split it at the colons
// Hours are worth 60 minutes.
var minutes = (+a[0]) * 60 + (+a[1]);
console.log(minutes);
Run Code Online (Sandbox Code Playgroud)
使用分数和乘法每60使用秒作为十进制(因此不完全准确)
var hms = '02:04:33'; // your input string
var a = hms.split(':'); // split it at the colons
// Hours are worth 60 minutes.
var minutes = (+a[0]) * 60 + (+a[1]);
console.log(minutes + "," + ((+a[2]) / 60));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9631 次 |
| 最近记录: |