Js序列化时间

 
 var time = "/Date(1279270720000+0800)/";
 var tme1 = ChangeDateFormat(time);
 alert(tme1);
image
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 on 2013-03-11 20:33  快乐于行  阅读(671)  评论(0编辑  收藏  举报