Json.stringify Conversion Date Incorrect reason : International time Zone (UTC) and China Time Zone (GMT) reason, East Eight district +8 is equal to the international time zone.
Workaround, re-Es5 the Date.prototype.toJSON method, the code is as follows:
functionDateFormat (date, FMT) {if(NULL= = Date | | undefined = = date)return‘‘; varn \ { "m+": Date.getmonth () + 1,//Month"D+": date.getdate (),//Day"H +": date.gethours (),//hours"m+": date.getminutes (),//points"S+": Date.getseconds (),//seconds"S": Date.getmilliseconds ()//milliseconds }; if(/(y+)/.test (FMT)) FMT = Fmt.replace (regexp.$1, (date.getfullyear () + ""). substr (4-regexp.$1. length)); for(varKincho)if(NewRegExp ("(" + K + ")"). Test (FMT)) FMT = Fmt.replace (regexp.$1, (regexp.$1.length = = 1)? (O[k]): (("XX" + o[k]). substr ("" +o[k])); returnFMT;} Date.prototype.toJSON=function() {returnDateFormat ( This, ' Yyyy-mm-dd ')}json.stringify (data);
Json.stringify Conversion Date Incorrect resolution method