java中jqGrid时间戳格式转换

找到如下代码

if( !isNaN( date - 0 ) && String(format).toLowerCase() == "u") {  
//Unix timestamp  
timestamp = new Date( parseFloat(date)*1000 );  
}   

改为,即去掉*1000

if( !isNaN( date - 0 ) && String(format).toLowerCase() == "u") {  
//Unix timestamp  
timestamp = new Date( parseFloat(date) );  
}   

前台调用

                {
                    name: "createTime",
                    formatter:"date",
                    formatoptions: {srcformat:'u',newformat:'Y-m-d'},
                    label:  "<span>createTime</span>"
                }

 

posted @ 2016-12-02 13:20  God丶魔多  阅读(2170)  评论(0编辑  收藏  举报