首页 > Web开发 > 详细

json时间格式化问题

时间:2015-04-08 14:27:16      阅读:250      评论:0      收藏:0      [点我收藏+]
技术分享
 1 function jsonDateFormat(jsonDate) {//json日期格式转换为正常格式
 2 try {
 3 var date = new Date(parseInt(jsonDate.replace("/Date(", "").replace(")/", ""), 10));
 4 var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
 5 var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
 6 var hours = date.getHours();
 7 var minutes = date.getMinutes();
 8 var seconds = date.getSeconds();
 9 var milliseconds = date.getMilliseconds();
10 return date.getFullYear() + "-" + month + "-" + day;
11 //+ " " + hours + ":" + minutes + ":" + seconds + "." + milliseconds;
12 } catch (ex) {
13 return "";
14 }
15 }
View Code

出自http://www.cnblogs.com/ahjesus

json时间格式化问题

原文:http://www.cnblogs.com/lb12081116/p/4402099.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!