jq-grid显示后台传来的被格式化为json的日期为【object object】

通过查询可以发现相关的日期已被解析成

":{"date":2,"day":3,"hours":14,"minutes":54,"month":10,"seconds":28,"time":1478069668000,"timezoneOffset":-480,"year":116},"

可以发现其中的time属性为1478069668000即是long类型的日期
下边我们自定义fomatter函数

function getLocalTime(value, row, index) {
//获取long型的日期
                var a = new Date(value.time);
                return formatDate(a);
            }
        //时间格式
        function formatDate(now) {
            var year = now.getFullYear();
            var month = now.getMonth() + 1;
            var date = now.getDate();
            var hour = now.getHours();
            var minute = now.getMinutes();
            var second = now.getSeconds();
            return year + "-" + month + "-" + date;
        }

相关column为

{name:'date', index:'date', width:60, align:"center", editable: true, formatter:currencyFmatter},  

你可能感兴趣的:(jq-grid显示后台传来的被格式化为json的日期为【object object】)