admin管理员组文章数量:1431918
I was testing around with NODE for a while now and I experienced a strange behaviour of JS Date()
object. The getDay()
and getMonth()
function are returning incorrect results. 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.
I was testing around with NODE for a while now and I experienced a strange behaviour of JS Date()
object. The getDay()
and getMonth()
function are returning incorrect results. 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.
Share Improve this question edited Jul 25, 2014 at 12:04 DAG asked Jun 19, 2013 at 12:02 DAGDAG 7,0244 gold badges41 silver badges63 bronze badges1 Answer
Reset to default 8The getDay
method returns the day of week, so 3 means wednesday.
The getMonth
method returns the zero based month, so 5 means june.
本文标签: javascriptDate Object in nodejs has some weird behaviourStack Overflow
版权声明:本文标题:javascript - Date Object in node.js has some weird behaviour - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745587005a2664966.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论