|
@@ -0,0 +1,22 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <script>
|
|
|
+ var date = new Date();
|
|
|
+ console.log(date.getFullYear(),'当前年份');
|
|
|
+ console.log(date.getMonth() + 1,'当前月份');//取值范围0~1
|
|
|
+ console.log(date.getDate(),'当前日期');
|
|
|
+ console.log(date.getHours(),'当前小时');
|
|
|
+ console.log(date.getMinutes(),'当前分钟');
|
|
|
+ console.log(date.getSeconds(),'当前秒数');
|
|
|
+ console.log(date.getMilliseconds(),'当前毫秒');
|
|
|
+ console.log(date.getDay(),'当前星期');
|
|
|
+ console.log(date.getTime(),'获取当前时间的时间戳');
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|