如 2020-01-11 11: 12: 20
let myDate = new Date()
let year = myDate.getFullYear(); //获取系统的年;
let nowMonth = myDate.getMonth() + 1;
let strDate = myDate.getDate(); // 获取系统日,
myDate.getHours(); //获取系统时,
myDate.getMinutes(); //分
myDate.getSeconds(); //秒
if (nowMonth < 10) {
nowMonth = '0' + nowMonth
}
if (strDate < 10) {
strDate = '0' + strDate
}
let time = year + '-' + nowMonth + '-' + strDate + ' ' + myDate.getHours() + ':' + myDate.getMinutes() + ':' + myDate.getSeconds()