I wanted to know as how to get the start date and end date by passing the month name to a function like:
var myMonth="September 2015"
?
I tried this link Get first and last date but the input is different from the one that is in the link
I wanted to know as how to get the start date and end date by passing the month name to a function like:
var myMonth="September 2015"
?
I tried this link Get first and last date but the input is different from the one that is in the link
By your question I think you want to get the particular months first date and last date. I can suggest the following:
For first date:
var myMonth="September 2015"
myMonth = "1 "+myMonth;
var d = new Date(myMonth);
d.getDate(); // will give the start date of the month
For last date:
var myMonth="September 2015"
myMonth = "1 "+myMonth;
var checkDate = new Date(myMonth);
var d = new Date(checkDate.getFullYear(), checkDate.getMonth() + 1, 0);
d.getDate(); // this will return the last date of the month
Here is the fiddle: http://jsfiddle.net/swaprks/5z2s2myt/