显示年月日.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>

posted @ 2020-05-12 14:43  阿向向  阅读(1131)  评论(0编辑  收藏  举报