var now = new Date();
var nowTimeStr = getTimeFromDate(new Date(now.getTime() - 1000));//现在的时间
//时间转换为:12:23:34
var getTimeFromDate = function (date) {
return date
.toTimeString()
.slice(0, 8)
.split(":")//去掉分号
.join("");
};
效果展示