js get month number code example
Example 1: javascript month name
let date = new Date(2020, 05, 21);
let longMonth = date.toLocaleString('en-us', { month: 'long' });
let shortMonth = date.toLocaleString('en-us', { month: 'short' });
let narrowMonth = date.toLocaleString('en-us', { month: 'narrow' });
Example 2: javascript getmonth
new Date().getMonth();
Example 3: 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()];