这是我在 Chrome 控制台中看到的内容:
> new Date(2012, 9, 13).toString()
"Sat Oct 13 2012 00:00:00 GMT+0800 (CST)"
> new Date(2012, 9, 13).getMonth()
9
显然应该是九月星期四
..我错过了什么?
最佳答案
月份
的格式为0
~ 11
,零索引。
月份
Integer value representing the month, beginning with 0 for January to 11 for December.
关于Javascript:Date对象的字符串表示比实际值多一个月 "later"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12417328/