-2

I'm facing a date issue with new Date() function. May i know why is this weired output is coming.

new Date(1984, 12, 13)
Sun Jan 13 1985 00:00:00 GMT-0500 (EST)

Here the month should be December but it results me with Jan.

user3655415
  • 107
  • 1
  • 8

1 Answers1

0

January is 0 in javascript , so javascript is counting up and is adding the date. That's why you get this result.

baao
  • 71,625
  • 17
  • 143
  • 203