JavaScript获取当前时间:
1 <html>
2 <body>
3 <script type="text/javascript">
4 var time = new Date();
5 var time1 = time.toString();
6 var time2 = time.toJSON();
7 var time3 = time2.substring(0,10)+" 23:59:59";
8 document.write(time+"<br>")
9 document.write(time1+"<br>")
10 document.write(time2+"<br>")
11 document.write(time3+"<br>")
12 </script>
13 </body>
14 </html>
1 Mon Sep 11 2017 09:33:47 GMT+0800 (中国标准时间)
2 Mon Sep 11 2017 09:33:47 GMT+0800 (中国标准时间)
3 2017-09-11T01:33:47.391Z
4 2017-09-11 23:59:59