`

根据某年某月某日获得这一天是星期几之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>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics