将Json序列化器强制转换为产生特定的日期时间格式(yyyy-mm-ddThh:mm:ss.msmsmsZ)

3
MyClass theSession = new MyClass() {
    accountId = 12345,
    timeStamp = DateTime.Now,
    userType = "theUserType"
};

System.Web.Script.Serialization.JavaScriptSerializer Json = new System.Web.Script.Serialization.JavaScriptSerializer();
Response.Write(Json.Serialize(theSession));

生成:

{"accountId":12345,"timeStamp":"\/Date(1268420981135)\/","userType":"theUserType"}

如何将日期呈现为:

"timestamp":"2010-02-15T23:53:35.963Z"

?


你可以让你的JS为你解释它。 - Allen Rice
3个回答

2

1

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接