删除日期时间值中的T字符 [英] Remove T character in datetime value
问题描述
我在gridview中有一个列,我将在其中显示从数据库中检索的DateTime值。我正在使用MVC,当日期时间值通过javascript传递时,日期和时间之间的空格将被替换为额外的T字符。我希望删除这个T并在其间留出空间。以下是我在javascript中的代码:
Hi, I have a column in gridview in which I will display DateTime value being retrieved from database. I am using MVC and when the datetime value being passed through javascript, the space between date and time is getting replaced with an extra "T" character. I wish to remove this "T" and have the space back in between. Below are my codes in javascript:
$.ajax({
async: false,
type: "POST",
url: "/Calendar/GetDateStart",
}).success(function (data) {
grid = $('#gdNotificationInformation').kendoUIGrid($.extend({
},
dataSource: {
data: data.data,
},
columns: [
{ field: "a1", title: "Date Start", headerAttributes: { style: "overflow: visible; white-space: normal" } },
}],
}));
});
我只是显示部分代码,因为这是唯一有问题的代码段。任何帮助,将不胜感激。谢谢。
我的尝试:
1.转换将日期时间值转换为Controller中的字符串,然后将其传递给javascript但无效。
I am just showing the partial codes as this is the only codes segment that is having problem. Any help would be appreciated. Thank you.
What I have tried:
1. Convert the datetime value into string in Controller before pass it into javascript but no avail.
推荐答案
.ajax({
async:false,
type :POST,
url:/ Calendar / GetDateStart,
})。success(function(data){
grid =
.ajax({ async: false, type: "POST", url: "/Calendar/GetDateStart", }).success(function (data) { grid =
( '#gdNotificationInformation')。kendoUIGrid(
('#gdNotificationInformation').kendoUIGrid(
.extend({
},
dataSource:{
data:data.data,
},
列:[
{field:a1,title:Date Start,headerAttributes:{style:overflow:visible; white-space:normal}},
}],
}));
});
.extend({ }, dataSource: { data: data.data, }, columns: [ { field: "a1", title: "Date Start", headerAttributes: { style: "overflow: visible; white-space: normal" } }, }], })); });
I我只是显示部分代码,因为这是唯一有问题的代码段。任何帮助,将不胜感激。谢谢。
我的尝试:
1.转换将日期时间值转换为Controller中的字符串,然后将其传递给javascript但无效。
I am just showing the partial codes as this is the only codes segment that is having problem. Any help would be appreciated. Thank you.
What I have tried:
1. Convert the datetime value into string in Controller before pass it into javascript but no avail.
这篇关于删除日期时间值中的T字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!