使用JS将日期给格式化
function formatTime() {
let time = new Date()
const [y, mo, d, h, m, s] = [
time.getFullYear(),
time.getMonth() + 1,
time.getDate(),
time.getHours(),
time.getMinutes(),
time.getMinutes(),
time.getSeconds(),
].map(item => item < 10 ? "0" + item : item)
return `${y}-${mo}-${d} ${h}:${m}:${s}`
}