Get the number of year into a month in javascripts code example
Example 1: how to get the number of days in a month in javascript
// instantiate a date object
var dt = new Date();
// dt.getMonth() will return a month between 0 - 11
// we add one to get to the last day of the month
// so that when getDate() is called it will return the last day of the month
var month = dt.getMonth() + 1;
var year = dt.getFullYear();
// this line does the magic (in collab with the lines above)
var daysInMonth = new Date(year, month, 0).getDate();
Example 2: getmonth javascript
var date=new Date();
var month=new Array();
month[0]="January";
month[1]="February";
month[2]="March";
month[3]="April";
month[4]="May";
month[5]="June";
month[6]="July";
month[7]="August";
month[8]="September";
month[9]="October";
month[10]="November";
month[11]="December";
var n = month[date.getMonth()];