0

SetUTCMonth returns weird result

When the current date is 31st of any month , setUTC date is jumping to next to next month . Example : Var cdate = new Date(‘August 31, 2018’) ; cdate.setUTCMonth(8); Now try to getUTCMonth(9) and check .. it is returning October .

16th Sep 2018, 7:53 PM
Suresh Poosapati
Suresh Poosapati - avatar
2 Réponses
+ 1
September 2018 have not a 31th day then js make your date like you want increment by one day (going to first october)
16th Sep 2018, 8:29 PM
KrOW
KrOW - avatar
0
when i use setUTCyear(x,y,z) then it is returning fine ..
16th Sep 2018, 7:54 PM
Suresh Poosapati
Suresh Poosapati - avatar