export function formatTime(time, format = 'yyyy年MM月dd日') { const date = new Date(time) const formatObj = { 'y+': date.getFullYear(), 'M+': date.getMonth() + 1, 'd+': date.getDate(), 'H+': date.getHours(), 'm+': date.getMinutes(), 's+': date.getSeconds() } for (let key in formatObj) { if (new RegExp(`(${key})`).test(format)) { const str = formatObj[key].toString() format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? str : ('00' + str).slice(str.length) ) } } return format }