码迷,mamicode.com
首页 > 其他好文 > 详细

在页面中输出当前客户端时间

时间:2015-11-09 15:45:37      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

new Date();
Date.prototype.Format = function (fmt) {
    var arr = {
        "y+": this.getFullYear(),
        "m+": this.getMonth() + 1,
        "d+": this.getDate(),
        "h+": this.getHours(),
        "M+": this.getMinutes(),
        "s+": this.getSeconds(),
        "week": new Array("日", "一", "二", "三", "四", "五", "六")[this.getDay()]
    };
 
    for (var item in arr) {
        var val = arr[item] < 10 ? "0" + arr[item] : arr[item];
        fmt = fmt.replace(new RegExp(item), val);
    }
    return fmt
};
 
setInterval(function () {
    $("div").html(new Date().Format("yyyy/mm/dd hh:MM:ss 周week"));
}, 100);

对现在我的来说有点费解,只能大致明白它的原理...( ⊙ o ⊙ )啊!要疯啦

在页面中输出当前客户端时间

标签:

原文地址:http://www.cnblogs.com/muwei/p/4949893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!