当前位置: 代码迷 >> JavaScript >> 依据某年某月某日获得这一天是星期几之js篇
  详细解决方案

依据某年某月某日获得这一天是星期几之js篇

热度:86   发布时间:2012-10-29 10:03:53.0
根据某年某月某日获得这一天是星期几之js篇
<html>
	<head>
		<title></title>
	
		<script type="text/javascript">
			  function toDate(uYear, uMonth, uDay) {
				var arr = "日一二三四五六".split("");
				with(document.all) {
					var vYear = parseInt(uYear, 10);
					var vMonth = parseInt(uMonth, 10);		
					var vDay = parseInt(uDay, 10);
				}
				var date = "星期"+arr[new Date(vYear,vMonth-1,vDay).getDay()];

				alert(date);

				return  date;
			  }

			window.onload = function() {
				var dateStr = "2010-07-01";
				var arr = dateStr.split("-");
				toDate(arr[0], arr[1], arr[2]);
			}
			  
		</script>
	</head>

	<body>
		
	</body>
</html>
  相关解决方案