<!doctype html>
<html>
<head>
<title>标题</title>
<meta charset="utf-8">
<script>
/*
var org=new Date(0);//原点
console.log(org);
var date1=new Date(24*3600*1000);
console.log(date1);//原点第二天
var max=Number.MAX_VALUE;//ms
var maxYears=max/1000/3600/24/365;
console.log(maxYears);//最大年数
var birth=new Date("1983/12/26");
var now=new Date();
var ms=now-birth;
var days=ms/1000/3600/24;
console.log(days);//活了多少天
*/
var now=new Date();
console.log(
now.getFullYear(),//2016
now.getMonth(),//6(计算机中的)
now.getDate(),//6
now.getDay(),//3
now.getHours()//16
);
now.setHours(18);
console.log(now);
now.setDate(14);
console.log(now);
now.setDay(0);
</script>
</head>
<body>
</body>
</html>
javascriptAPI(Date)
最新推荐文章于 2024-03-29 08:23:14 发布