实例代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
var now = new Date();
now.getFullYear();//年
now.getMonth();//月
now.getDay();//日
now.getHours();//时
now.getMinutes();//分
now.getSelection();//秒
now.getTime();//时间戳
console.log(new Date(1615317794461))
</script>
</head>
<body>
</body>
</html>
结果展示