[英]Date Object in node.js has some weird behaviour
I was testing around with NODE for a while now and I experienced a strange behaviour of JS Date()
object. 我现在正在用NODE进行测试一段时间,并且遇到了JS Date()
对象的奇怪行为。 The getDay()
and getMonth()
function are returning incorrect results. getDay()
和getMonth()
函数返回错误的结果。 I thought I messed up somewhat somewhere in my app, but I tested in the console as well and still the same behaviour. 我以为自己在应用程序中的某个地方有些混乱,但是我也在控制台中进行了测试,并且仍然具有相同的行为。 Here is the my log of the console: 这是控制台的我的日志:
$ node
> var currentDate = new Date();
undefined
> currentDate
Wed Jun 19 2013 13:54:20 GMT+0200 (CEST)
> currentDate.getDay()
3
> currentDate.getMonth()
5
it seems to off 'a bit'. 似乎“有点”。
I do not now what' s going on and web-research did not help me as well. 我现在不知道发生了什么,网络研究也没有帮助我。
The getDay
method returns the day of week, so 3 means wednesday. getDay
方法返回星期几,因此3表示星期三。
The getMonth
method returns the zero based month, so 5 means june. getMonth
方法返回从零开始的月份,因此5表示6月。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.