Previous projects have been encountered with a database with datetime type data returned to the foreground will become a timestamp
It's obviously not what we want.
So I was in the original project selected in the front-end JS format date (XXXX) Form of processing now I want to be a little stupid
Today brainwave thought that it would be possible to turn the DateTime into a string on the server to return to the result with this article
Service side:
1Datagetentities context =Newdatagetentities ();2 varQuerytyphoon = context. T_typhoonpaths.where (i = I.typhooncode = =Typhooncode). ToList ();3Newtonsoft.Json.Converters.IsoDateTimeConverter ISO =NewNewtonsoft.Json.Converters.IsoDateTimeConverter ();4Iso. DateTimeFormat ="YYYY-MM-DD Hh:mm:ss";5 6 varPath = ( fromPinchQuerytyphoon7 Select New8 {9 P.id,Ten P.air_pressure, One P.dottype, A P.latitude, - P.longitude, - P.move_direction, the P.move_speed, - P.seven_wind, - P.ten_wind, - P.typhooncode, + P.typhoonname, - P.wind_power, + P.wind_speed, A P.wind_time at }); - returnContent (jsonconvert.serializeobject (path, ISO));
It is important to note that the JSON returned at this time is actually a string and not an object, so you need to turn around at the front end:
1 var tdata = json.parse (data);
C # uses LINQ processing to return JSON display with datetime type data/date (XXXXX)/