I am attempting to get the month name of the current date using the JavaScript Date(); class. I have noticed that there isn't a way to do this unless I create an array of strings with the month names.
var month = new Date();
month.getMonth();
> 10
I am looking to get "November" instead of an integer. Is there a function to be called to get the string name on the Date() class or do I have to create an array like:
var monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
var d = new Date();
document.write("The current month is " + monthNames[d.getMonth()]);
I know there are libraries and the above method to do this, but I'm curious to know if there is a built in function to do this that I am overlooking.