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

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

你会发现弹出来的值是:

new Date()得出来的日期不对的分析_第1张图片

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

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

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

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

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

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

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

你可能感兴趣的:(Date)