js获取时间,获取当前时间
js获取当前时间格式,在一些项目过程中大家可能需求,就收藏了一下。
<!DOCTYPE html> <html> <head> <title>js获取时间</title> </head> <body> <script type="text/javascript"> var now = new Date() var day = now.getDate() var month = now.getMonth() + 1 var year = now.getFullYear() var hour = now.getHours() var minute = now.getMinutes() var second = now.getSeconds() document.write(year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second) </script> </body> </html>
本文作者: Liaodeity
本文链接: https://www.jianbaizhan.com/article/301
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!