首页 > Web开发 > 详细

js时间显示设置

时间:2016-09-09 14:47:16      阅读:192      评论:0      收藏:0      [点我收藏+]
//对日期中部分小于10的数字前边添加0
function zero(s){
    return s < 10 ? ‘0‘ + s: s;
}

var date=new Date(),
       year = date.getFullYear(),
       month = date.getMonth()+1,
       day = date.getDate(),
       hour = date.getHours(),
       minute = date.getMinutes(),
       second = date.getSeconds();
var newTime=year+‘年‘+zero(month)+‘月‘+zero(day)+‘日 ‘+zero(hour)+‘:‘+zero(minute)+‘:‘+zero(second);

 

js时间显示设置

原文:http://www.cnblogs.com/dongxiaolei/p/5856269.html

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