jQuery – Javascript – Dates between two dates

Show all dates between two dates value.


var day = 1000*60*60*24;
date1 = new Date('2013-07-30');
date2 = new Date("2013-08-04");

var diff = (date2.getTime()- date1.getTime())/day;
for(var i=0;i<=diff; i++)
{
var xx = date1.getTime()+day*i;
var yy = new Date(xx);

console.log(yy.getFullYear()+”-“+(yy.getMonth()+1)+”-“+yy.getDate());
}

 

http://stackoverflow.com/questions/17943977/dates-between-two-dates