jqGrid中的AM / PM日期格式 [英] AM/PM date formatting in jqGrid

查看:109
本文介绍了jqGrid中的AM / PM日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法确定我在jqGrid上的日期格式出错的地方。我通过C#格式化的日期为 MM / dd / yyyy hh:mm:ss tt 产生 01/20/2012 10:01:在我的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的文档,它看起来应该是正确的格式。有人会看到我出错的地方吗?



谢谢!

解决方案

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



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


I'm having trouble figuring out where I'm going wrong with this date formatting on jqGrid. I pass in the date formatted by C# as MM/dd/yyyy hh:mm:ss tt which produces 01/20/2012 10:01:26 PM.

In my jqGrid I apply formatting as follows:

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'} },
...
],

This is working fine for everything except the AM/PM. It's always showing AM in my grid. From jqGrid's documentation, it looks like this should be the right format. Does anyone see where I'm going wrong?

Thanks!

解决方案

I found a solution. I changed the formatting in C# to yyyy-MM-dd HH:mm:ss and my colModel to formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'm/d/Y h:i:s A' }.

The source format is the ISO8601Long format. I did not use 'ISO8601Long' since I'm using local data and want to sort.

这篇关于jqGrid中的AM / PM日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆