We can do this using Javascript's
Parameters:
Start - Starting Date
end - Ending Date
Note: you should pass Date object as parameters.
If you are using jQuery Date picker, you can get selected date object like below,
usage and Example :
If you are using datepicker, you can use this code,
If you are going to use your own date string, you should make it as date object. Then only you can use in it. You can use this piece of code,
Live Demo
Have any doubt, feel free to comment here!
Date()
object. You can use this following function to get between two dates. It will return array
. Here we are using isDate()
and isValidRange()
functions to make sure is the given string is Date and end date is not greater then start date. If the given string is not date, then it will return "error occured!!!... Please Enter Valid Dates" in browser console and it will return empty array.Parameters:
Start - Starting Date
end - Ending Date
Note: you should pass Date object as parameters.
If you are using jQuery Date picker, you can get selected date object like below,
var start = $("#from").datepicker("getDate"),
end = $("#to").datepicker("getDate");
you can get selected date object using 'getDate
' parameter in datepicker.usage and Example :
If you are using datepicker, you can use this code,
var start = $("#from").datepicker("getDate"),
end = $("#to").datepicker("getDate");
var between = getDates(start, end);
If you are going to use your own date string, you should make it as date object. Then only you can use in it. You can use this piece of code,
var start = new Date('2014-07-13'),
end = new Date('2014-07-17');
var between = getDates(start, end);
Live Demo
Have any doubt, feel free to comment here!
works like charm...tq
ReplyDeleteGlad I could help you
DeleteHi Cj, tried this code, but i am struggling with displyang the dates in between.
ReplyDeletewhen i click the button, i does not display anything. please help
Hi Cj, tried this code, but i am struggling with displyang the dates in between.
ReplyDeletewhen i click the button, i does not display anything. please help
Sorry for the late reply.. Any errors showed in browser console?
DeleteIt is not working is it using jquery ?
ReplyDeletei want to display just the date and day what modifications i should do in this.i dont want to display gmt 5:30 and all
ReplyDelete