帖子
帖子
用户
博客
课程
12
返回列表 发新帖
23
帖子
1
勋章
988
Y币
感谢大神分享
0
帖子
0
勋章
5
Y币
太牛逼  赞一个
0
帖子
0
勋章
5
Y币
Date.prototype.Format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
console.log(new Date(1521516506166).Format("yyyy-MM-dd hh:mm:ss"))
395
帖子
0
勋章
520
Y币
要怎样才可以收藏
12
您需要登录后才可以回帖 登录

本版积分规则