node.js中的Date对象有一些奇怪的行为

DaG*_*ner 1 javascript datetime node.js

我正在使用NODE测试一段时间,我遇到了JS Date()对象的奇怪行为.该getDay()getMonth()功能正在返回不正确的结果.我以为我在我的应用程序中的某个地方搞砸了,但我在控制台中也进行了测试,但仍然是相同的行为.这是我的控制台日志:

$ node
> var currentDate = new Date();
undefined
> currentDate
Wed Jun 19 2013 13:54:20 GMT+0200 (CEST)
> currentDate.getDay()
3
> currentDate.getMonth()
5
Run Code Online (Sandbox Code Playgroud)

它似乎有点"关闭".

我现在不知道发生了什么,网络研究也没有帮助我.

Guf*_*ffa 8

getDay方法返回星期几,因此3表示星期三.

getMonth方法返回基于零的月份,因此5表示6月.