// 要比较的时间 let checkTime = '2023-01-01 00:00:00' let today = new Date(2022, 4) //当天 today.setMonth(today.getMonth()-3)//三个月前,时间戳 console.log('22', today.getFullYear() +'-' + (today.getMonth() + 1) + '-01 00:00:00' ) let newTodayTmp = new Date(today.getFullYear() +'-' + (today.getMonth() + 1) + '-01 00:00:00').getTime() // 要比较的时间戳 let checkTmp = new Date(checkTime).getTime() console.log('判断大小', newTodayTmp > checkTmp)