function getCurrentDate() {
var d = new Date()
var year = d.getFullYear()
var month = d.getMonth()
month = month + 1 > 12 ? 1 : month + 1
month = month > 9 ? month : '0' + month.toString()
var day = d.getDate()
var hour = d.getHours()
hour = hour > 9 ? hour : '0' + hour.toString()
var minute = d.getMinutes()
minute = minute > 9 ? minute : '0' + minute.toString()
var second = d.getSeconds()
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
}
js获取当前时间时分秒
最新推荐文章于 2024-07-18 11:50:26 发布