//将/Date(...)格式转换为yyyy-MM-dd型日期格式

//将/Date(...)格式转换为yyyy-MM-dd型日期格式

function ChangeDateFormat(time) {
    if (time != null) {
        var date = new Date(parseInt(time.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;
    }
    return "";
}

posted @ 2013-01-16 17:13  前行者  阅读(1049)  评论(0编辑  收藏  举报