显示年月日.html

<body>
<div style="border-radius: 10px; background-color:yellow ;">


<script type="text/javascript">

var mydate = new Date();
document.writeln("Year:"+mydate.getFullYear()+'<br>');
document.writeln("Month:"+(mydate.getMonth()+1)+'<br>');
document.writeln("Date:"+mydate.getDate()+'<br>');
document.writeln("Hours:"+mydate.getHours()+'<br>');
document.writeln("Minutes:"+mydate.getMinutes()+'<br>');
document.writeln("Seconds:"+mydate.getSeconds()+'<br>');
//星期几转成大写的
var weekDay = new Array('日','一','二','三','四','五','六');
var a = mydate.getDay()
document.writeln("WeekDay:"+weekDay[a]+'<br>');

// var str = "日一二三四五六".charAt(mydate.getDay());
// document.writeln("星期:" +str);

</script>
</div>
</body>

原文地址:https://www.cnblogs.com/d534/p/12876113.html