Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Below is the date object I’ve in JavaScript. Can anyone tell me how to generate the name of the month from it?

var objDate = new Date("10/11/2009");

1 Answer

0 votes
by (19.7k points)

See the below code implementation:

const monthNames = ["January", "February", "March", "April", "May", "June",

  "July", "August", "September", "October", "November", "December"

];

const d = new Date();

document.write("The current month is " + monthNames[d.getMonth()]);

Interested in Java? Check out this Java Certification by Intellipaat.   

Browse Categories

...