您的位置:首页 > 其它

如何得到当前日期7个工作日日期(不包含周六日)

2017-09-15 14:48 405 查看
function getworkday(date,itervalByDay){
var  date=new Date();
var millisceonds =date.getTime();
for(var i=1;i<=itervalByDay;i++){
millisceonds +=24*60*60*1000;
date.setTime(millisceonds);
if(date.getDay()==0||date.getDay()==6) i--;
}
return date;
}
var d=getworkday(new Date(),7); //当前时间,7个工作日

youWant=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds(); //格式化

console.log(youWant);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: