如何得到当前日期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);
相关文章推荐
- C++ 中MFC DLL 如何链接SQLite数据库,增加数据,并得到当前日期
- [Java] 如何通过当前时间得到日期,月份,年
- 如何统计一段时间内但不包含周六日的所有日期
- 如何创建文件名中包含当前日期的文件?
- 如何得到当前的系统日期以及对当前的系统日期进行30天的加值!
- 使用js时,如何获取系统当前时间并且得到格式为"yyyy年MM月"的日期
- PHP如何得到当前日期与时间(一)
- 如何得到当前时间日期
- java简易算法+循环版动态日历(包含周六周日和当前日期标识)
- javascript如何得到当前时间之后的时间值
- 如何获取当前的年份月份还有天数或者当前准确的日期
- 批处理:如何获取当前日期前一天或者后一天的日期
- 如何得到应用程序的当前路径
- 如何判断一个日期是否属于当前系统本月的日期
- C# 如何获取当前日期和时间
- php如何得到当前执行脚本路径,包括所得到参数
- 如何得到DataGridView当前记录的所有值
- 得到当前电脑日期的前后两天
- JAVA中如何获得当前日期
- unity3d 如何得到当前物体播放的动画