programming-examples/js/Date/Write a JavaScript function to get the month name from a particular date..js

6 lines
312 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
var month_name = function(dt){
mlist = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
return mlist[dt.getMonth()];
}
console.log(month_name(new Date("10/11/2009")));
console.log(month_name(new Date("11/13/2014")));