C# Json时间类型的转换
DateTime dt1 = new DateTime(1970, 1, 1);
dt1 = dt1.AddMilliseconds(long.Parse(list.Items[i].UpdatedAt));
dt1 = dt1.ToLocalTime();
list.Items[i].UpdatedAt = dt1.ToString("yyyy-MM-dd HH:mm:ss");
var sssss = DateTime.Now;
//Model m = new Model { Id = 1, Dt = DateTime.Now };
JavaScriptSerializer js = new JavaScriptSerializer();
string str = js.Serialize(sssss);
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);