Javascript格式化json返回的时间(/Date(1482747413000)/)
2016-12-27 18:16
260 查看
//时间处理,类似/Date(1482747413000)/的形式,得到xxx年xx月xx日 11:11:11 function ChangeDateFormat(jsondate) { jsondate = jsondate.replace("/Date(", "").replace(")/", ""); if (jsondate.indexOf("+") > 0) { jsondate = jsondate.substring(0, jsondate.indexOf("+")); } else if (jsondate.indexOf("-") > 0) { jsondate = jsondate.substring(0, jsondate.indexOf("-")); } var date = new Date(parseInt(jsondate, 10)); var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); return date.getFullYear() + "年" + month + "月" + currentDate + "日" + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); }
相关文章推荐
- SpringMVC返回的json数据Date(时间)格式化的问题
- Json 返回时间格式为 /Date(1416882720000)/ 格式化方法
- Spring3.1返回Json时格式化日期Date
- javascript扩展date对象格式化日期时间输出(二)
- S dc7e pringMVC 返回Java8 时间JSON数据的格式化问题处理
- json时间数据,使用javascript格式化字符串
- 关于JSON数据格式返回时间数据格式化问题
- springmvc访问返回数据类型格式化json报http status 406 和json时间格式化
- 解决SpringMVC 返回Java8 时间JSON数据的格式化问题处理
- Spring3.1返回Json时格式化日期Date
- json返回数据库的时间格式为/Date(1332919782070)/,在前台用js怎么转换
- javascript下Date对象的时间格式化函数
- JavaScript中Date对象与格式化时间输出
- 格式化json返回的时间
- javascript扩展date对象格式化日期时间输出
- Struts2的JSON插件--格式化时间/控制属性返回
- SpringBoot返回date日期格式化,解决返回为TIMESTAMP时间戳格式或8小时时间差
- SpringMVC 返回Java8 时间JSON数据的格式化问题处理
- json返回数据库的时间格式为/Date(1477294037000)/,怎样在前台进行格式化转换
- 格式化Spring MVC 返回json的Date格式