现在的位置: 首页 > 综合 > 正文

前台页面反序列化Newtonsoft.Json序列化的时间问题

2014年02月16日 ⁄ 综合 ⁄ 共 368字 ⁄ 字号 评论关闭
Newtonsoft.Json的时间格式是"//Date(353521212046+0800)//"
前台页面用javascript转换
function ChangeDateFormat(cellval)
 {
     var date =newDate(parseInt(cellval.replace("/Date(","").replace(")/",""), 10));
     var month = date.getMonth() + 1 < 10 ?"0" + (date.getMonth() + 1) : date.getMonth() + 1; 
     var currentDate = date.getDate() < 10 ?"0" + date.getDate() : date.getDate(); 
     returndate.getFullYear() + "-"+ month + "-"+ currentDate; 
 }

抱歉!评论已关闭.