getMonday(date){
let today=new Date(date); //月份为0-11
let yesterday_milliseconds=today.getTime()-1000*60*60*24;
let yesterday=new Date();
yesterday.setTime(yesterday_milliseconds);
let year=yesterday.getFullYear();
let day=yesterday.getDate();
let month=yesterday.getMonth()+1;
if(month<10)
{
month="0"+month;
}
let yesterday=year+"-"+month+"-"+day;
return yesterday
}
js 获取当前时间的前一天的年月日
最新推荐文章于 2024-06-20 17:21:13 发布