计算时间间隔具体每一天

计算时间间隔,中间的每一天。

 

 function getDaysBetween(dateString1, dateString2) {
            var startDate = Date.parse(dateString1);
            var endDate = Date.parse(dateString2);
            while (startDate < endDate) {
                startDate = startDate + 1 * 24 * 60 * 60 * 1000;
                console.log(new Date(startDate));
            }
        }
        getDaysBetween("2021-02-20", "2021-03-02")

 

posted @ 2021-02-26 14:19  云霄紫潭  阅读(117)  评论(0编辑  收藏  举报