首页 > 代码库 > 每天一个JavaScript实例-UTC日期和时间

每天一个JavaScript实例-UTC日期和时间

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>每天一个JavaScript实例-UTC日期和时间</title>
<script>
window.onload = function(){
	var aaa = document.getElementById("date");
	var dt = new Date();
	//console.log(dt);
	//aaa.innerHTML = "<p>"+dt+"</p>";
	
	var today = new Date();
	var utcDate = today.toUTCString();
	aaa.innerHTML = "<p>本地时间"+dt+"</p>" + "<p>utc时间"+utcDate+"</p>";
}
</script>
</head>

<body>

<div id = "date">
</div>

</body>
</html>

每天一个JavaScript实例-UTC日期和时间