函数封装返回当前的时分秒
作者:互联网
function getDate () { var time = new Date() var h = time.getHours() h = h<10 ? '0' + h : h var m = time.getMinutes() m = m<10 ? '0' + m : m var s = time.getSeconds() s = s<10 ? '0' + s : s return h + ':' + m + ':' + s } console.log (getDate())
标签:function,封装,函数,getHours,Date,time,var,new,时分秒 来源: https://www.cnblogs.com/lxjs/p/16245725.html