var nowTime = new Date(); // Date Thu Dec 02 2021 16:10:53 GMT+0800 (中国标准时间)
let time = nowTime.getFullYear() + '-' + (nowTime.getMonth() + 1) + '-' +nowTime.getDate() + ' ' + nowTime.getHours() + ':' + nowTime.getMinutes() + ':' + nowTime.getSeconds();
console.log(time); // 2021-12-2 16:10:53
// 一天的时间86400000
var yesterdsay = new Date(new Date().getTime() - 86400000);