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; }
以上就是格式化json传递日期的方法的详细内容。
