2012-02-09 32 views
0

我无法弄清楚在jqGrid上这种日期格式出错的位置。我传入格式为C#的日期为MM/dd/yyyy hh:mm:ss tt,它生成01/20/2012 10:01:26 PMjqGrid中的上午/下午日期格式

在我的jqGrid我申请的格式如下:

colModel: [ 
... 
    { name: 'EndTime', index: 'EndTime', sorttype: 'date', formatter:'date', formatoptions: {srcformat:'m/d/Y h:i:s A', newformat:'m/d/Y h:i:s A'} }, 
... 
], 

这是除的AM/PM一切工作正常。它总是在我的网格中显示AM。从jqGrid的文档看来,这应该是正确的格式。有没有人看到我要去哪里错了?

谢谢!

回答

1

我找到了解决方案。我将C#中的格式更改为yyyy-MM-dd HH:mm:ss,将colModel更改为formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'm/d/Y h:i:s A' }

源格式是ISO8601Long格式。因为我使用本地数据并且想排序,所以我没有使用'ISO8601Long'。

相关问题