//返回 每一天 组成数组 node.js
function getDateArray(startD, end) {
var startDate = new Date(startD);
var endDate = new Date(end);
var days = endDate.getTime() - startDate.getTime();
var time = parseInt(days / (1000 * 60 * 60 * 24)) + 1;
// console.log(time)
var today = endDate; // 获取今天时间
var date_array = [];
for (var i = 0; i < time; i++) {
date_array.unshift(utility.YYYYMMDD(endDate));
today.setTime(today.getTime() - 24 * 3600 * 1000);
}
return date_array;
}
//日期格式
new Date()
function formatDate(oDate) {
var year=oDate.getFullYear(); //获取系统的年;
var month=oDate.getMonth()+1; //获取系统月份,由于月份是从0开始计算,所以要加1
if (month<10)
month='0'+month
var day=oDate.getDate(); // 获取系统日
if(day<10)
day='0'+day;
var curdate=year+'-'+month+'-'+day;
return curdate;
}