<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Date</title>
</head>
<body>
<script>
console.dir(window);
var date = new Date(); // 返回当前的中国标准时间
// 返回的是一个时间戳(timestamp),大小值是从1970年 1月1日 00:00:00开始到现在的毫秒数(13位)
// 秒级 10位
console.log(Date.now());
console.log(date.getTime()); // 返回时间戳
console.log('某年----', date.getFullYear());
//这个方法返回的月份值是一个基于0-11的整数,其中0表示一月,1表示二月,以此类推,11表示十二月。
console.log('某月----', date.getMonth() + 1); // 0-11
console.log('某天----', date.getDate());
console.log('某时----', date.getHours()); // 24小时
console.log('某分----', date.getMinutes());
console.log('某秒----', date.getSeconds());
console.log('某毫秒----', date.getMilliseconds());
</script>
</body>
</html>
上述运行结果: