Javascript Date.getDay()返回一周中的错误日期

Javascript Date.getDay()返回一周中的错误日期,javascript,date,Javascript,Date,我的服务器发送当前服务器时间,我需要用JS处理它们 var currentDate = new Date(someYear, someMonth, someDay, 12); console.log(currentDate.getDate()+'.' +currentDate.getMonth()+'.' +currentDate.getFullYear() ); //8.4.2016 - this is right, today

我的服务器发送当前服务器时间,我需要用JS处理它们

var currentDate = new Date(someYear, someMonth, someDay, 12);
console.log(currentDate.getDate()+'.'
            +currentDate.getMonth()+'.'
            +currentDate.getFullYear()
        ); //8.4.2016 - this is right, today is 8th April of 2016
console.log(currentDate.getDay()); // 0. But today is Friday, not Monday!

为什么currentDay.getDay()返回了错误的数字?

@hacket抱歉,这是一个输入错误。
getMonth
是基于0索引的,所以4是
May
@hacker到底为什么有人把月份从“0”开始?感谢您提供的解决方案。使用基于0索引的值,您可以轻松使用数组。请参见:Month 4=May。月份从0开始计算。这就是星期天,这是一周的第一天(第0天)@hacket抱歉,这是一个打字错误。
getMonth
是基于0索引的,所以4是
May
@hacket到底为什么有人把月份从“0”开始?感谢您提供的解决方案。使用基于0索引的值,您可以轻松使用数组。请参见:Month 4=May。月份从0开始计算。这就是星期天,这是一周的第一天(第0天)