关于js接收后台时间戳转换成时间问题
来源:互联网 发布:淘宝轮毂 编辑:程序博客网 时间:2024/05/05 23:19
后台回传数据 work[name:"...",id:"...",checkdata:"2017-7-28".....]经过toJSONString后checkdata变成了4141415765415(时间戳)
List<Work> works=this.workBiz.findWork(classid, semester, checkDate,page,rows); int total=workBiz.findworknum(classid,null,null,null); Map<String,Object> map=new HashMap<String,Object>(); map.put("rows", works); map.put("total", total); jsonStr=JSON.toJSONString(map);
前台js代码
datagrid=$("#show_find_checkwork").datagrid({ url:"/Examination2.0/work_findWorkresult.action",//加载的URL pagination:true,//显示分页 pageSize:10,//分页大小 pageList:[5,10,15,20],//每页的个数 fit:true,//自动补全 toolbar : '#find_table_slelct', fitColumns:true, queryParams : { examineeclassid:classname, chackdate:checkDate, semester:semester, editionid:editionid, subjectid:subjectid, chapterid:chapterid, }, iconCls:"icon-save",//图标 columns:[[ //每个列具体内容 { field:'wid', title:'编号', width:50, }, {field:'wname',title:'作业名',align :'center',width:100}, {field:'checkdate',title:'检查时间',align : 'center',width:100, formatter : function(value, row, index) { return change(row.checkdate) }}, {field:'description',title:'作业描述',align : 'center',width:200}, {field:'remark',title:'备注',align : 'center',width:100} , {field:'result',title:'操作',align : 'center',width:100, formatter : function(value, row, index) { if(row.result!=null&&row.result!=""&&row.result!=undefined){ return '<a href=\"changefindwork.jsp?wid='+row.wid+'">查看</a>'; }else{ return '<label>未检查</label>'; } }} ]] })
将时间戳转换成data并用正则表达式去掉无用数据
function change(data) { var birthday = new Date(data); var time=birthday.toLocaleString() //"2017/7/28 上午 12:12:12" time=time.replace(/上午(\w|:)*/,""); //"2017/7/28 " //time=time.replace(/\s$/,""); return time;}
阅读全文
0 0
- 关于js接收后台时间戳转换成时间问题
- 关于js转换时间戳
- 将后台返回的时间戳用JS转换成可读的展示时间
- JS 时间戳转换成时间格式
- js 时间戳转换时间
- android时间戳转换成日期(与php后台),日期转换成时间戳小问题记录
- js转换时间戳
- js 时间戳转换
- js-时间的转换问题
- 关于js中时间戳的问题
- JS 时间转换时间
- js中把后台时间转换成显示时间的方法 两种
- Java后台时间转换
- JS 将 格式化的时间 转换成 时间戳
- js将时间戳转换成时间,自定义格式
- JS 时间转换为时间戳函数
- JS时间戳和时间之间转换
- Javascript、js 时间日期时间戳转换
- Let's Go Green UVALive
- Mysql基本语句操作(二)---一对多的实现和关联语句的用法
- vue页面跳转拦截器
- Linux下C++编程(二)----vim简单使用
- Chrome 开发者工具的错误与调试
- 关于js接收后台时间戳转换成时间问题
- scrapy-redis集成scrapy-splash使用教程
- 图像特征的特点及其常用的特征提取与匹配方法
- TP语法
- PAT B1060. 爱丁顿数
- hdu 6047 Maximum Sequence
- Tiling UVALive
- Java日期格式转换
- 使用ViewPager的功能(解决切换Fragment状态不保存)