首页 > Web开发 > 详细

JS获取当前时间

时间:2015-01-22 00:01:55      阅读:393      评论:0      收藏:0      [点我收藏+]
 1 //获取当前时间,格式:yyyy-mm-dd hh:mm:ss
 2 function getNow() {
 3    var now = new Date(),
 4    y = now.getFullYear(),
 5    month = now.getMonth(),
 6    d = now.getDate(),
 7    h = now.getHours(),
 8    m = now.getMinutes(),
 9    s = now.getSeconds();
10    return (y + "-" + (month + 1) + "-" + d + " " + h + ":" + m + ":" + s);
11 }

 

JS获取当前时间

原文:http://www.cnblogs.com/wanshi1989/p/4240317.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!