I have a date object:
var thedate = new Date("2012-05-02T11:00:00.000+0000");
When I do getMonth() I get 4, but when I do getDay() I get 3? I want to make it so that when I call getDay, I get what’s reflected in the original string (2). I could just subtract 1 from getDay(), but I’m not sure if that’s the right way to do it, and whether it applies to all dates.
According to MDN,
getMonthwill return a number in the range 0-11 (so 0 is for January), andgetDaywill return the day of the week in the range 0-6 (so 0 is for Sunday). If you want to get the day in month, you should usegetDate, which will return a number in the range 1-31.