getCurrent() {let now = new Date();let year = now.getFullYear(); //年let m = now.getMonth() + 1; //月let d = now.getDate(); //日let h = now.getHours(); //时let i = now.getMinutes(); //分let nowD = `${year}/${m}/${d} ${h}:${i}`;let nowDS = new Date(nowD).getTime();return nowDS},
获取当天时间的0点 获取当天时间的59分59秒
// 获取当前日期和时间const currentDate = new Date()// 创建一个新的日期对象,以避免修改原始对象const endDate = new Date(currentDate)const startDate = new Date(currentDate)startDate.setHours(0, 0, 0, 0)endDate.setHours(23, 59, 59, 999)console.log(startDate,endDate)