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, 2022 in Web Development by gaurav
• 23,260 points
548 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, 2022 by rajatha
• 7,640 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, 2022 in Web Development by rajatha
• 7,640 points
397 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, 2022 in Web Development by rajatha
• 7,640 points
429 views
0 votes
0 answers

jQuery UI DatePicker - Change Date Format

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

Jun 23, 2022 in Web Development by gaurav
• 23,260 points
817 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, 2022 in Web Development by rajatha
• 7,640 points
235 views
0 votes
1 answer

Date range picker on jquery ui datepicker

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

answered Jun 27, 2022 in Web Development by rajatha
• 7,640 points
4,144 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, 2022 in Web Development by gaurav
• 23,260 points
220 views
0 votes
1 answer

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

How to set jQuery draggable min/max-left and ...READ MORE

answered Jul 25, 2022 in Web Development by rajatha
• 7,640 points
355 views
0 votes
1 answer

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

How to set jQuery draggable min/max-left and ...READ MORE

answered Jul 25, 2022 in Web Development by rajatha
• 7,640 points
803 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, 2022 in Web Development by rajatha
• 7,640 points
827 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, 2022 in Web Development by rajatha
• 7,640 points
5,315 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP