1
我將某些屬性作爲JSON字符串傳遞給客戶端。但是,日期不以正確的格式打印。它顯示出一些數字,如1644506800。這是我做過什麼日期格式打印不正確
var query = (from n in CDC.NCDCPoints
where n.EVENT_TYPE_ID == et && n.BeginDate == b && n.EndDate == e
select new {
n.EVENT_TYPE_ID,
begindate1 = n.BeginDate,
n.EndDate,
n.BeginLAT,
n.BeginLONG,
n.EndLAT,
n.EndLONG});
if (query.Any())
{
return new JavaScriptSerializer().Serialize(query.ToList());
}
jQuery中,
$.ajax({
type: "POST", url: "Data.aspx/CheckInsertRecord",
data: "{EventType:'" + eventtype + "',BeginDate:'" + begindate + "'," +
"EndDate:'" + enddate+"' }",
contentType: "application/json; charset=utf-8", dataType: "json",
success: function (msg) {
alert(msg.d);
var data = $.parseJSON(msg.d);
alert("A record of this event already exists in the database.\n" +msg.d+".");
}
});
所以u能告訴我如何得到正確格式的日期?
我需要做的是在客戶端。那麼,你是否知道我可以使用反序列化的任何默認函數 – 2011-06-16 16:13:07
我們可以看到你的一些客戶端代碼? – harryovers 2011-06-16 16:14:58
我更新了代碼。 – 2011-06-16 16:16:07