new Date()得出来的日期不对的分析

var date= new Date(2011,06,12)
alert(date);

你会发现弹出来的值是:

2011-07-04-13-16

我明明写的是06为啥是7月份:原因是:

Date()
返回当日的日期和时间。

getDate()
从 Date 对象返回一个月中的某一天 (1 ~ 31)。

getDay()
从 Date 对象返回一周中的某一天 (0 ~ 6)。

getMonth()
从 Date 对象返回月份 (0 ~ 11)。

getFullYear()
从 Date 对象以四位数字返回年份。

看见红色的没有,就是这个地方搞的鬼了~

原文地址:https://www.cnblogs.com/xmphoenix/p/2097320.html