JavaScript Date Object provides a method that returns the number value for month of year for the specified Date value. JavaScript getMonth() method returns the month of year associated to the specified Date. It returns the value between 0 and 11 starting from 0 = January, 1 = February and so on. Now lets try the following sample code to understand the logic behind it: