问答详情
源自:7-3 返回/设置年份方法

为什么月份不对呀 显示是六月

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>获得年份 </title>
<script type="text/javascript">
var mydate=new Date();
document.write("年份:"+mydate.getFullYear()+"<br/>");
document.write("月份:"+mydate.getMonth()+"<br/>");
document.write("日期:"+mydate.getDay()+"<br/>");
document.write("时:"+mydate.getHours()+"<br/>");
document.write("分:"+mydate.getMinutes()+"<br/>");
document.write("秒:"+mydate.getSeconds());

</script>
</head>
<body>
</body>
</html>

提问者:糖糖很涩 2015-07-06 16:37

个回答

  • 时小光
    2015-07-06 16:47:02

    月份的范围在0-11,显示5其实是6月