Javascript 如何在jQuery中只打印工作日在两个特定日期之间的日期?

Javascript 如何在jQuery中只打印工作日在两个特定日期之间的日期?,javascript,jquery,Javascript,Jquery,在这里,我尝试在jQuery中打印特定日期的日期数和整个工作日,但它给出的输出如下所示:- 输出 [Fri Jun 01 2018 00:00:00 GMT+0530 (IST), Sat Jun 02 2018 00:00:00 GMT+0530 (IST), ......, ......, //further till end date ] 我使用的代码是:- var start = $("#txtFromDate").datepicker("getD

在这里,我尝试在jQuery中打印特定日期的日期数和整个工作日,但它给出的输出如下所示:-

输出

[Fri Jun 01 2018 00:00:00 GMT+0530 (IST),
 Sat Jun 02 2018 00:00:00 GMT+0530 (IST),
 ......,
 ......, //further till end date
]
我使用的代码是:-

 var start = $("#txtFromDate").datepicker("getDate"),
  end = $("#txtToDate").datepicker("getDate"),
  currentDate = new Date(start.getTime()),
  between = []
;

while (currentDate <= end) {
    between.push(new Date(currentDate));
    currentDate.setDate(currentDate.getDate() + 1);
}
    console.log(between);

我如何才能得到我的输出任何帮助都可以感谢。谢谢。

构建数组后,使用.pop()删除最后一个元素,使用.shift()删除第一个元素。这应该只留下介于之间的日期。

查看日期格式@zanerock我试过这个代码我编辑我的问题你能帮我吗?返回的是字符串,不是日期。因此,您可能希望在执行推送时格式化日期,然后拥有一个表示日期的格式化字符串数组:
between.push($.datepicker.formatDate('md-yyyy',currentDate))@zanerock天怎么办?你是在问如何打印天的名称吗?查看前面评论中链接的
formatDate
文档。我不明白你在说什么。你能帮我做到这一点吗。哎呀,进一步回顾一下,我想我误解了你的问题。很抱歉
var start = $("#txtFromDate").val($.datepicker.formatDate('M dd yyyy', new Date())),
end = $("#txtToDate").val($.datepicker.formatDate('M dd yyyy', new Date())),
currentDate = new Date(start.getTime()),
between = []
;

while (currentDate <= end) {
    between.push(new Date(currentDate));
    currentDate.setDate(currentDate.getDate() + 1);
}
console.log(between);
 [Friday, 06-01-2018,
  Saturday, 06-02-2018,
  ......,
  ......, //further till end date
 ]