The JS code is as follows:
Date.prototype.format = function (format) {
/*
* format= "Yyyy-mm-dd hh:mm:ss";
*/
var o = {
"m+": This.getmonth () + 1,
"D+": this.getdate (),
"H +": this.gethours (),
"m+": this.getminutes (),
"S+": This.getseconds (),
"q+": Math.floor ((This.getmonth () + 3)/3),
"S": This.getmilliseconds ()
};
if (/(y+)/.test (format)) {
Format = Format.replace (regexp.$1, (this.getfullyear () + ""). substr (4-regexp.$1.length));
}
For (var k in O) {
if (New RegExp ("(" + K + ")"). Test (format)) {
Format = Format.replace (regexp.$1, regexp.$1.length = = 1? o[k]:("XX" + o[k]). substr (("" + o[k]). length);
}
}
return format;
};
Convert JSON date format
function toDate (objdate, format) {
var date = new Date ();
Date.settime (Objdate.time);
Date.sethours (objdate.hours);
Date.setminutes (objdate.minutes);
Date.setseconds (Objdate.seconds);
return Date.format (format);
}
JSON returns the call:
$.ajax ({
Type: "POST",
URL: "/slark/member/orderinfo/orderinfolist.do",
Async:false,
Data:formparam,
DataType: "JSON",
Success:function (data) {
for (var i in data) {
Content = "<a href=\" \ "> Time" +todate (data[i].arrdate, "yyyy-mm-dd") + "</a>";
$ ("#contenter"). Append (content);
}
}
});
ToDate (Data[i].arrdate, "YYYY-MM-DD")
YYYY-MM-DD is the format to be displayed