代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
//可以用typeOf判断数据类型
//标准对象:number、string、boolean、object、function、undefined
var now = new Date();//当前时间
now.getFullYear();//年
now.getMonth();//月 0-11月 外国的表示
now.getDate();//日
now.getDay();//星期几
now.getHours();//时
now.getMinutes();//分
now.getSeconds();//秒
now.getTime();//时间戳 全世界统一 1970 1.1 0:00:00 毫秒数
console.log(new Date(4335423423));//时间戳转为时间
//转换
now.toLocaleString(); //注意,调用的是一个方法,不是属性
now.toGMTString();
</script>
</head>
<body>
</body>
</html>