效果图–wx:–qiao----min----liu–
const formatTime = date => {
const year = date.getFullYear() //年
const month = date.getMonth() + 1 //月
const day = date.getDate() //日
const hour = date.getHours() //时
const minute = date.getMinutes() //分
const second = date.getSeconds() //秒
return [year].map(formatNumber) + '' + [month].map(formatNumber) + '' + [day].map(formatNumber) + '' + [hour].map(formatNumber) + [minute].map(formatNumber) + [second].map(formatNumber)
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}