js中时间戳转化为时间

translateDate : function(current_date) {  
    var date = new Date(current_date);  
    var datetime = date.getFullYear() + "-" + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1)) + "-"  
            + (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " "  
            + (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":"  
            + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes());  
    return datetime;  
},

欢迎分享本文,转载请保留出处:前端ABC » js中时间戳转化为时间

赞 (3)
分享到:更多 ()

发表评论 0