问题情景:
数据库:Mysql
时间字段格式:datatime
前台显示格式为:时间戳
解决方案:
ajaxResponse(JSON.toJSONString(orderMap,SerializerFeature.WriteDateUseDateFormat), response);
如上述代码。其中,orderMap是返回到前台的结果集合,主要是加上【SerializerFeature.WriteDateUseDateFormat】,会把时间数据转化成”yyyy-MM-dd HH:mm”这种格式
—Fastjson
补充:在spring mvc中,使用@ResponseBody注解来完成解析