just get month from date javascript code example

Example 1: Javascript get month name

var  months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var d = new Date();
var monthName=months[d.getMonth()]; // "July" (or current month)

Example 2: 3 letter months javascript array

var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var today = new Date();

// Show date in "dd-mm-yyyy' format.
var d = today.getDate();
var m = months[today.getMonth()];
var y = months.getFullYear();

console.log(d + "-" + m + "-" + y);