date - javascript getDate getMonth returns wrong month -


this question has answer here:

i know there have been other posts can't see figure out doing wrong here. below code:

var d = new date(); var month = d.getmonth(); system.log(d); system.log(month); 

my output looks this:

[2015-04-01 09:24:53.012] [i] wed apr 01 2015 09:24:53 gmt-0400 (edt) [2015-04-01 09:24:53.012] [i] 3 

shouldn't bottom output 4?

thanks in advance

it array. month starts 0, should plus 1 yourself.

you can take @ :)

http://www.w3schools.com/jsref/jsref_getmonth.asp


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -