摘要:<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <ti
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script type="text/javascript">
var mydatas= new Date();
document.write(mydatas +'<br>');
document.write(mydatas.getFullYear()+"年"+'<br>');
var month=Array(12);
month[0]="一月";
month[1]="二月";
month[2]="三月";
month[3]="四月";
month[4]="五月";
month[5]="六月";
month[6]="七月";
month[7]="八月";
month[8]="九月";
month[9]="十月";
month[10]="十一月";
month[11]="十二月";
document.write("现在是"+month[mydatas.getMonth()]+"<br>");
console.log("现在是星期"+ mydatas.getDay());
console.log("今天是"+ mydatas.getDate()+"日");
console.log("现在是"+ mydatas.getHours()+"时");
console.log("现在是"+ mydatas.getMinutes()+"分");
console.log("现在是"+ mydatas.getSeconds()+"秒");
</script>
</body>
</html>
批改老师:天蓬老师批改时间:2019-01-27 08:53:11
老师总结:有一个toLocalString()方法, 很有用, 了解一下