I need to increment between a range of dates using javascript. I have start_date and end_date in the following format.
var start_date = Fri Nov 09 2012
var end_date = Thu Nov 15 2012
I need to call a function which accepts all the dates by looping between start dates and end dates as parameter. Something like this
for (date = start_date; date < end_date; date++) {
getCellFromDate(date, calInstance);
}
I need to provide the parameters to getCellFromDate in the same date format(Fri Nov 09 2012) . How do I achieve this..I am new to javascript.. Please help
To do the iteration in pure JavaScript, without the aid of any other date library, you can change
to
That will go to the next day at the same time. There are 86400000 milliseconds in a day.
This will iterate through date objects. You will need to use a date formatter and parser to go back and forth between date objects and strings. There are many ways to do this. See this SO question for help.