get Date between 2 dates in jquery with format dddd MMMM Do YYYY

0 votes

Currently I'm using jQuery Date Range Picker

Now I have 2 dates:

Start date="Wednesday July 29th, 2015"

End dates="Wednesday August 5th, 2015"

So now I'm trying to get and display dates between start date and End date with "dddd MMMM Do, YYYY" format same date format mentaion for startdate

Expected o/p:-

Wednesday July 29th, 2015

Thursday July 30th, 2015

Friday July 31st, 2015

Saturday August 1st, 2015

Sunday August 2nd, 2015

Monday August 3rd, 2015

Tuesday August 4th, 2015

Wednesday August 5th, 2015


Aug 5 in Web Development by gaurav
• 17,580 points
11 views

1 answer to this question.

0 votes

This is fairly easy to achieve with moment:

var Start_date="Wednesday July 29th, 2015"
var End_date="Wednesday August 5th, 2015"

var start=moment(Start_date, "dddd MMMM Do, YYYY")
var end = moment(End_date, "dddd MMMM Do, YYYY")
console.log(start,end)

var today = start
while (today <= end){
    console.log(today.format("dddd MMMM Do, YYYY"));
    today = today.add(1, "days");
}

Output:

"Wednesday July 29th, 2015" 
"Thursday July 30th, 2015" 
"Friday July 31st, 2015" 
"Saturday August 1st, 2015"
"Sunday August 2nd, 2015" 
"Monday August 3rd, 2015" 
"Tuesday August 4th, 2015" 
"Wednesday August 5th, 2015" 
answered Aug 5 by rajatha
• 7,040 points

Related Questions In Web Development

0 votes
1 answer

Get checkbox value in jQuery

To get the value of the Value ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,040 points
17 views
0 votes
1 answer

Get checkbox value in jQuery

if you have set a class or id for it, you ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,040 points
11 views
0 votes
0 answers

jQuery UI DatePicker - Change Date Format

I am using the UI DatePicker from ...READ MORE

Jun 23 in Web Development by gaurav
• 17,580 points
8 views
0 votes
1 answer

More efficient way to do parent().parent().parent() etc. in jquery

The jQuery parent() and parents() methods return the ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,040 points
19 views
0 votes
1 answer

Date range picker on jquery ui datepicker

Thanks I need this kind of code. ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,040 points
50 views
0 votes
0 answers

jQuery UI: connect sortable lists through tabs

Here is an example at jQuery UI official site, ...READ MORE

Jul 20 in Web Development by gaurav
• 17,580 points
9 views
0 votes
0 answers

How to set jQuery draggable min/max-left and min/max-right

I made a copy of JSbin for ...READ MORE

Jul 20 in Web Development by gaurav
• 17,580 points
9 views
0 votes
0 answers

How to set jQuery draggable min/max-left and min/max-right

I made a copy of JSbin for ...READ MORE

Jul 21 in Web Development by gaurav
• 17,580 points
16 views
0 votes
1 answer

Get current date in DD-Mon-YYY format in JavaScript/Jquery

Get Current Date In DD-Mon-YYY Format In ...READ MORE

answered Jun 28 in Web Development by rajatha
• 7,040 points
13 views
0 votes
1 answer

Get current date in DD-Mon-YYY format in JavaScript/Jquery

get current date in jquery in dd/mm/yyyy ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,040 points
23 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP