Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to get the month name from Date using JavaScript ?

  • Last Updated : 15 Sep, 2020

The purpose of this article is to get the month name from a particular date using JavaScript getMonth() method. This method is used to fetch the month(0 to 11) from the given Date object. It returns an integer value ranges from (0 to 11) Zero (0) means January, 1 means February, and so on, till 11 means December.


Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!


Example: The below code is used to display the current month belonging to the particular Date.


<!DOCTYPE html>
<body style="text-align:center;">
        How to get month name from 
        Date using Javascript?
    <button onclick="myFunction()">
        Click Me!
    <h3 id="demoID" style="color:green;">
        function myFunction() {
            // initializing an array 
            const months = [
                "January", "February", 
                "March", "April", "May", 
                "June", "July", "August",
                "September", "October", 
                "November", "December"
            const d = new Date();
                "demoID").innerHTML =
                "The current month is " 
                + months[d.getMonth()];


  • Before clicking on button:

  • After clicking on button:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!