【问题标题】:How to change date format in jqgrid如何在 jqgrid 中更改日期格式
【发布时间】:2013-05-13 12:02:38
【问题描述】:

我有一个与 jqgrid 相关的问题。我在 jqgrid 表中显示了日期,例如“FRI MAY 17 00:00:00 IST 2013”​​。我想将其格式更改为“17/5/2013”​​。我该怎么做?

{name:'checkin', index:'checkin', width:60, searchoptions:{sopt:['eq']}},

这是我的代码。

【问题讨论】:

  • 您用来填充网格的数据的输入格式是什么?推荐的源格式为ISO8601Short(“Ymd”,如“2013-05-18”)或ISO8601Long(“Ymd H:i:s”,如“2013-05-18 14:13:53”)
  • @Oleg : 我使用输入格式作为日期。
  • 我的问题是您使用哪种输入格式?。您只写了您显示日期的格式,而不是您为网格填充数据的格式。您是使用datatype: "local" 并将数据填充到您的JavaScript 代码中,还是使用datatype: "json"(或“xml”)并从服务器返回数据?
  • @Oleg: 哦,对不起。我使用了数据类型:“json”。
  • 您使用哪种数据输入格式?

标签: jquery jqgrid jqgrid-formatter


【解决方案1】:

试试这个:

formatter: 'date', formatoptions: { srcformat: 'l, F d, Y', newformat: 'd/m/Y'}

【讨论】:

    【解决方案2】:

    试试这个!!!

    {name:'checkin', index:'checkin', width:60, formatter: 'date', 
         formatoptions: { newformat: 'd/m/Y'}, 
         searchoptions:{sopt:['eq']}},
    

    【讨论】:

      【解决方案3】:

      试试这些:

      formatter: 'date', formatoptions: { srcformat: 'd/m/Y', newformat: 'd/m/Y'}
      

      这里给出:JQgrid json date format

      【讨论】:

      猜你喜欢
      • 2013-05-30
      • 1970-01-01
      • 1970-01-01
      • 2019-01-09
      • 2021-06-07
      • 2015-08-26
      • 2017-11-08
      相关资源
      最近更新 更多