js获取当日时间。00:00:00。 23:59:59
let date1 = new Date(new Date(new Date().toLocaleDateString()).getTime());
let day = this.timeFormat(date1)
//今天 23:59:59
let date2 = new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1);
var day_end = this.timeFormat(date2)
//一周前
let date3 = new Date(new Date(new Date().toLocaleDateString()).getTime() - 3600 * 1000 * 24 * 7);
let dat_week = this.timeFormat(date3)
//昨天 2023-7-3
let date4 = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + (time.getDate() - 1)
//当天
let date5 = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate()
//一个月前
let date6 = time.getFullYear() + '-' + time.getMonth() + '-' + time.getDate()
格式化时间
//格式化时间
timeFormat(time) {
return time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate() + ' ' + time.getHours() + ':' + time.getMinutes() + ':' + time.getSeconds()
}