+ 12

Problem with code

There is problem that my code shows the month of November not December https://code.sololearn.com/W5825qK13Kcj/?ref=app

3rd Dec 2019, 3:34 PM
ツSampriya😘ツ - avatar
1 Answer
+ 5
The `getMonth` method of a Date object returns a zero based value indicating the month. That is, 0 for January, 1 for February, and so on. To get passed it, just add one to <mon> variable value var mon = d.getMonth() + 1; https://www.w3schools.com/jsref/jsref_getmonth.asp
3rd Dec 2019, 4:02 PM