Skip to content Skip to sidebar Skip to footer

Javascript Date - Month Always Increment

Hello I encountered strange behavior with javascript date. I show in this example: Why is month always increment? Is normal behavior or its my problem? Thanks

Solution 1:

Javascript Date's month starts from 0. So 7 is actually 8th Month which is August.

month

Integer value representing the month, beginning with 0 for January to 11 for December.

Solution 2:

In the JavaScript Date() object, the the month is an integer, starting at 0.

  • 0 = January
  • 1 = February
  • 2 = March

and so on.

Solution 3:

Javascript date month starts form zero index only ie jan is 0 and december is 11enter image description here

Post a Comment for "Javascript Date - Month Always Increment"