<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
//Date对象来表示时间
//1.获取标准时间
var d=new Date();
console.log(d); //"Wed Jul 24 2019 14:52:07 GMT+0800 (中国标准时间)"
//2.自定时间"..."
var d1=new Date("11/25/1997 11:11:11");//"Tue Nov 25 1997 11:11:11 GMT+0800 (中国标准时间)"
console.log(d1);
// //3.属性
// 1. .constructor //返回Date对象的函数
// 2. .prototype //原型对象,方便调用添加的属性和方法
// //4.常用方法
// 1. .getTime() //获取时间戳(返回 格林尼治1970 年 1 月 1 日0:0:0至今的毫秒数。)
// //可在一段代码前后获取两个时间戳来相减,提取代码执行时间
// 2. .getDate() //从 Date 对象返回一个月中的某一天 (1 ~ 31)。
// 3. .getDay() //从 Date 对象返回一周中的某一天 (0 ~ 6)。
...
// https://www.w3cschool.cn/jsref/jsref-obj-date.html
</script>
</body>
</html>
原文:https://www.cnblogs.com/wangdongwei/p/11246921.html