Possible Duplicate:
javascript date creation, can't set the correct month
I have script like:
var year = 2011;
var month = 3;
var day = 1;
var start = new Date(year, month, day, 0,0,0,0);
When it comes time to use start I find that it ends up evaluating to April 4, 2011. Any ideas why the month gets bumped up by 1?
Because the only item in a date whose counter starts with a 1 is a date. Its the way that has been defined.
Everything else (day, hour, min) the first item is defined with a 0.
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date