当然了,很正常啊。
<script language="javascript">
cDate=new Date();
document.write(cDate.getYear()+"-"+(cDate.getMonth()+1)+"-"+cDate.getDay());
document.write(cDate.toLocaleString());
</script>
<script language="javascript">
cDate=new Date();
document.write(cDate.getYear()+"-"+(cDate.getMonth()+1)+"-"+cDate.getDay());
document.write(cDate.toLocaleString());
</script>
<script language="javascript">
cDate=new Date();
document.write(cDate.getYear()+"-"+(cDate.getMonth()+1)+"-"+cDate.getDay());
document.write(cDate.toLocaleString());
</script>
前者:2002-6-3
后者:2002年6月5日 18:20:54
cDate=new Date();
document.write(cDate.getYear()+"-"+(cDate.getMonth()+1)+"-"+cDate.getDate());
document.write("<br>"+cDate.toLocaleString());
</script>
Because:
The value returned by getDay is an integer corresponding to the day of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.
真是该像一位签名档说得:“多看页书,少问个问题”getDay() 返回的是星期几;返回日期是getDate();
getMonth()返回月份。一月从0开始。所以,,,,,,谢谢,Andrawu我把你那段copy了,你cDate.getMonth()+1---当然是6了,