var month=new Array(12);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";
document.write("The current month is " + month[d.getMonth()]);
function testDateInfo() {var months = new Array();var days = new Array();var workingDate = new Date();workingDate.setHours(0, 0, 0, 0);workingDate.setDate(1);var RE = new RegExp("([a-z]+)","ig");//-- get day names 0-6for (var i = 0; i < 7; i++) {
var day = workingDate.getDay();//-- will eventually be in orderif (days[day] == undefined)days[day] = workingDate.toLocaleDateString().match(RE)[0];workingDate.setDate(workingDate.getDate() + 1);}//--get month names 0-11for (var i = 0; i < 12; i++) {workingDate.setMonth(i);months.push(workingDate.toLocaleDateString().match(RE)[1]);}alert(days.join(",") + " \n\r " + months.join(","));}
moment().format("MMM"); // "Apr" - current datemoment(new Date(2012, 01, 04)).format("MMM"); // "Feb" - from a local datemoment.utc(new Date(2012, 00, 04).format("MMM"); // "Jan" - from a UTC date
const formatter = new Intl.DateTimeFormat('fr', { month: 'short' });const month1 = formatter.format(new Date());const month2 = formatter.format(new Date(2003, 5, 12));console.log(`${month1} and ${month2}`); // current month in French and "juin".
var monthsLocalizedArray = function(locale) {var result = [];for(var i = 0; i < 12; i++) {result.push(new Date(2010,i).toLocaleString(locale,{month:"long"}));}return result;};