jqgrid 时间日期格式转换问题NaN,date类型年份异常

处理方式,formatter 方式回显,js处理日期格式问题


代码如下:


{name:'paytime',index:'paytime',
                    formatter:function(cellvalue, options, rowObject){
                        if(cellvalue==null ||cellvalue==""){return ""}
                        var time = new Date(cellvalue);
                        return time.getFullYear()+"-"
                            +(time.getMonth()<9?("0"+(time.getMonth()+1)):(time.getMonth()+1))+"-"
                            +(time.getDate()<10?("0"+time.getDate()):(time.getDate()))+" "
                            +(time.getHours()<10?("0"+time.getHours()):(time.getHours()))+":"
                            +(time.getMinutes()<10?("0"+time.getMinutes()):(time.getMinutes()))+":"
                            +(time.getSeconds()<10?("0"+time.getSeconds()):(time.getSeconds()));
                 }},

猜你喜欢

转载自blog.csdn.net/su717854075/article/details/78569878