//格式化日期:yyyy-MM-dd
function formatDate(date) {
var myyear = date.getFullYear();
var mymonth = date.getMonth() + 1;
var myweekday = date.getDate();
if (mymonth < 10) {
mymonth = "0" + mymonth;
}
if (myweekday < 10) {
myweekday = "0" + myweekday;
}
return (myyear + "-" + mymonth + "-" + myweekday + " 23:59:59");
}
var now = new Date();
var nowTime = now.getTime() ;
var day = now.getDay();
var oneDayTime = 24*60*60*1000
var SundayTime = nowTime + day*oneDayTime ;//显示周日
console.log(formatDate(new Date(SundayTime))) ;
转载自:https://blog.csdn.net/haibo0668/article/details/89033598?utm_source=app&app_version=5.3.1&code=app_1562916241&uLinkId=usr1mkqgl919blen