您的位置:首页 > Web前端 > JavaScript

JavaScript -- Date

2014-05-12 00:20 148 查看
----- 015-Date.html -----

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>标题</title>
</head>
<body>
<script type="text/javascript">
var now = new Date();
document.write("现在时间<br/>" + now + "<br/>");
document.write(now.getFullYear()+"年"
+ (now.getMonth()+1) + "月"
+ now.getDate() + "日"
+ "星期" + now.getDay() + " "
+ now.getHours() + "时"
+ now.getMinutes() + "分"
+ now.getSeconds() + "秒"
+ now.getMilliseconds() + "毫秒" + "<br/>");
document.write(now.toGMTString() + "<br/>");
document.write(now.toUTCString() + "<br/>");
document.write(now.toString() + "<br/>");
document.write(now.toDateString() + "<br/>");
document.write(now.toTimeString() + "<br/>");
document.write(now.toLocaleString() + "<br/>");
document.write(now.toLocaleDateString() + "<br/>");
document.write(now.toLocaleTimeString() + "<br/>");
document.write("1970 to now:" + Date.UTC() + "<br/>");
document.write("1970 to now:" + Date.parse(now) + "<br/>");
document.write("UTC时差分钟数:" + now.getTimezoneOffset() + "<br/>");
</script>
</body>
</html>


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: