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

来源:互联网 发布:华腾软件学院 编辑:程序博客网 时间:2024/06/05 23:46
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);
阅读全文
0 0
原创粉丝点击