标签:style ar io color os sp for java on
Model m =
new
Model { Id = 1, Dt = DateTime.Now };
JavaScriptSerializer js =
new
JavaScriptSerializer();
string
str = js.Serialize(m);
str = Regex.Replace(str,
@"\\/Date\((\d+)\)\\/"
, match =>
{
DateTime dt =
new
DateTime(1970, 1, 1);
dt = dt.AddMilliseconds(
long
.Parse(match.Groups[1].Value));
dt = dt.ToLocalTime();
return
dt.ToString(
"yyyy-MM-dd HH:mm:ss"
);
});
Response.Write(str);
JavaScriptSerializer 序列化json 时间格式
标签:style ar io color os sp for java on
原文地址:http://www.cnblogs.com/aishangjimo/p/4168480.html