I want to create a list of dates starting from 2014/0/1 to 2020/11/31 (dates are represented in JavaScript).
This is the code
var initialTime = new Date(2014, 0, 1);
var endTime = new Date( 2050, 11, 31);
var arrTime = [];
arrTime.push(initialTime);
if( initialTime < endTime) {
for( var q = initialTime; q <= endTime; q.setDate(q.getDate() + 1)) {
arrTime.push(q);
}
}
document.querySelector("#Time").innerHTML = arrTime;
This is what the code returns. It is just a list of " Sun Jan 01 2051 00:00:00 GMT-0500 (EST)." How do I correct this?