+ 2

Isn't 'month ' upgraded in solo learn?

var d = new Date ; var month = d.getMonth() ; document.write(month) ; This is giving result as 6..

1st Jul 2017, 10:02 AM
Omniscient
Omniscient - avatar
3 Respostas
+ 3
bro.......getMonth() value starts from 0 .....just like index in string or array......... use d.getMonth()+1 to get accurate month..... know more from here https://stackoverflow.com/questions/18624326/getmonth-in-javascript-gives-last-month
1st Jul 2017, 10:19 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 3
@chirag ghosh But yesterday I got the correct value......?
1st Jul 2017, 10:41 AM
Omniscient
Omniscient - avatar
+ 2
And I am getting all the correct values for day and year but not for month... It has to be fixed
1st Jul 2017, 10:45 AM
Omniscient
Omniscient - avatar