我的SQL Server数据库中有一个包含两列的表 ' whenDateTime' (日期时间,NULL) '持续时间' (时间(7),null)
从我的javascript中,我用
调用JSON服务 $.getJSON("myService/GetAllHappenings",
function (allData) {
var mappedAction = $.map(allData, function (item) {
return new Happening(item)
});
self.Happenings(mappedAction);
//... some other code...
});
,其中
self.Happenings = ko.observableArray();
检查" myService / GetAllHappenings"作为我的浏览器(Firefox)中的URL,我得到:
<duration>PT1M</duration>
<whenDateTime>2014-11-12T11:26:00</whenDateTime>
在数据库中,值为:
sduration whenDateTime
00:01:00.0000000 2014-11-12 11:26:00.000
但是当我单步执行$ .getJSON时,值就可以了,直到行
self.Happenings(mappedAction);
在此行之前,mappedAction包含数据
"2014-11-12T11:26:00"
"00:01:00"
但是在此行之后,数据将转换为
"30.06.2020 11:26"
"00:00"
这怎么可能发生? 我该如何解决这个问题?
答案 0 :(得分:0)
我认为super cool's answer很好。我试图在<input type="text">
元素之上实例化jQuery-UI日期选择器时遇到了奇怪的问题,这些元素应该在我datetimes
发送时显示datetimes
。