jqGrid中的AM / PM日期格式
我无法弄清楚我在jqGrid上的日期格式出错了。 我将格式化为C#的日期传递给MM/dd/yyyy hh:mm:ss tt
,产生01/20/2012 10:01:26 PM
。
在我的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的文档来看,它看起来应该是正确的格式。 有谁看到我哪里出错了?
谢谢!
我找到了解决方案。 我将C#中的格式更改为yyyy-MM-dd HH:mm:ss
和我的colModel formatoptions: { srcformat: 'Ymd H:i:s', newformat: 'm/d/Y h:i:s A' }
。
源格式为ISO8601Long格式。 我没有使用’ISO8601Long’,因为我使用本地数据并想要排序。