如何从c#ext.net调用javascript

时间:2016-11-02 05:47:48

标签: javascript c# asp.net datetime ext.net

在我的项目中,当我在chrome中运行它时显示错误的时间。探险家它显示真实。所以我写这个js代码,但它仍然无法正常工作。 这是我的js;



  var FormatTrxStartDate = function (value, record) {
            var processDate = new Date(value);
            return processDate.getDate() + "." + (processDate.getMonth() + 1) + "." +
            processDate.getFullYear() + " " + processDate.getHours() + ":" +
            processDate.getMinutes() + ":" + processDate.getSeconds();
        };




这就是我使用它的地方;

<ext:ModelField Name="TrxStartDate" Type="String" >
<Convert Fn='FormatTrxStartDate' />
</ext:ModelField>

2 个答案:

答案 0 :(得分:2)

以不正确的日期格式传递参数值

使用processDate.getFullYear()==> processDate.getFullYear().toDateString()日期数据转换为字符串

答案 1 :(得分:1)

X.Js.Call("FormatTrxStartDate ",value,record);

请尝试此代码