公共js方法
var getDateStr=function (myDate){
if(myDate==null){myDate=new Date();
}
var str = myDate.getFullYear()+"-"+(myDate.getMonth()+1)+"-"+myDate.getDate();
return str;
}
返回的json
[{"community_id":"","community_name":"创新社区","detail_address":"中坤路","email":"1220532@qq.com","harbor_id":0,"harbor_name":"","password":"","real_id":"410221199310037801","real_name":"张祖源","register_time":{"date":20,"day":1,"hours":22,"minutes":22,"month":2,"seconds":22,"time":1490019742000,"timezoneOffset":-480,"year":117},"role_id":0,"sex":"man","state":0,"tel":"110","type":"","user_id":3,"user_name":"zzy"},{"community_id":"","community_name":"创新社区","detail_address":"中坤路","email":"admin@qq.com","harbor_id":0,"harbor_name":"","password":"","real_id":"41000","real_name":"代振威","register_time":{"date":27,"day":1,"hours":11,"minutes":23,"month":2,"seconds":59,"time":1490585039000,"timezoneOffset":-480,"year":117},"role_id":0,"sex":"男","state":0,"tel":"18838181046","type":"","user_id":33,"user_name":"dzw"},{"community_id":"","community_name":"创新社区","detail_address":"中坤路","email":"admin@qq.com","harbor_id":0,"harbor_name":"","password":"","real_id":"41000","real_name":"代振威","register_time":{"date":27,"day":1,"hours":11,"minutes":26,"month":2,"seconds":28,"time":1490585188000,"timezoneOffset":-480,"year":117},"role_id":0,"sex":"男","state":0,"tel":"18838181046","type":"","user_id":34,"user_name":"dzwgg"}]
var b="<tr><td>"+result[o].user_name+"</td><td>"+result[o].real_name+"</td><td>"+result[o].sex+"</td><td>"+result[o].real_id+"</td><td>"+result[o].email+"</td><td>"+result[o].community_name+"</td><td>"+result[o].tel+"</td><td>"+getDateStr(new Date(result[o].register_time.time))+"</td></tr>"
getDateStr(new Date(result[o].register_time.time))这样调用获得2017-3-20