View Full Version : got stucked with date() object

05-28-2009, 12:01 PM
hey i was working on Date() object of javascript

when i write

today=new Date();

here everything was correct but when i print month then i got currentmonth-1 that if the currentmonth is 5 then t get 4

if the current month is 07 then i get 06.

at last i worked by adding 1 with month like month+1

is there any one who faced this problem or know about this problem.

please let me know what is the cause behind this

05-28-2009, 12:22 PM
That's no problem, that's just how it works. getMonth returns 0-11 and not 1-12, just like getDay returns 0-6, and not 1-7.