毫秒数日前格式化

常用在C#后台传送到前台毫秒数日前,js格式化

function ChangeDateFormat(cellval) {
    var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    return date.getFullYear() + "-" + month + "-" + currentDate;
}

 

posted @ 2015-02-08 17:25  Wangyk  阅读(260)  评论(0编辑  收藏  举报