JS 获取星期几

<!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();
		var myDay=myDate.getDay();//获取存储当前日期
		var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
  		document.write("今天是:" + weekday[myDay]);
	</script>
</head>
<body>
</body>
</html>

 

posted @ 2018-08-21 14:43  格鲁特baby  阅读(53)  评论(0编辑  收藏  举报