18_日期.html 612 B

12345678910111213141516171819
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <script>
  11. //Date采取的是时间戳的形式表示时间,所谓的时间戳指的是从1970年1月1日0时0秒0分开始经过的毫秒数来计算时间
  12. var a = new Date()
  13. console.log(a.getTime())
  14. console.log(a.getFullYear())
  15. console.log(a.getMonth())
  16. //getMonth( )以数字(0-11)返回日历的月份
  17. </script>
  18. </body>
  19. </html>