封装时分秒
function getTime() { var time = new Date(); var hour = time.getHours(); var minute = time.getMinutes(); var seconds = time.getSeconds(); if (hour < 10) { hour = '0' + hour; } if (minute < 10) { minute = '0' + minute; } if (seconds < 10) { seconds = '0' + seconds; } return '现在是' + hour + ':' + minute + ':' + seconds; } getTime();
标签:hour,seconds,08,js,time,var,时分秒,minute From: https://www.cnblogs.com/doubleyancode/p/16787923.html