获取当前时间年月日时分秒 格式:20001212120000

  作者:chrispy

const d = new Date()const myYear = d.getFullYear()const myMonth = d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1const myDate = d.getDate() < 10 ? '0' + d.getDate() : d.getDate()const myHours = d.ge

const d = new Date()

const myYear = d.getFullYear()

const myMonth = d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1

const myDate = d.getDate() < 10 ? '0' + d.getDate() : d.getDate()

const myHours = d.getHours()

const myMinutes = d.getMinutes()

const mySeconds = d.getSeconds()

const _time = '' + myYear + myMonth + myDate + myHours + myMinutes + mySeconds


有用  |  无用

猜你喜欢