SOURCE

var myDate = new Date();
var h = myDate.toLocaleTimeString();
var hh = myDate.getHours();       //获取当前小时数(0-23)
var mm = myDate.getMinutes();     //获取当前分钟数(0-59)
var ss = myDate.getSeconds();     //获取当前秒数(0-59)
console.log(hh + "时" + mm + "分" + ss + "秒");
var sj = prompt("请输入时间(0000格式)");
let 时 = sj.slice(0, 2);
let 分 = sj.slice(2, 4);
let xz = (hh * 60 * 60) + (mm * 60) + ss;
let xx = 时 * 3600 + 分 * 60 - xz;
if (xx < 0) {
    xx = xx + 24 * 3600;
}
console.log(xx);
console 命令行工具 X clear

                    
>
console