6

I have a date that is passed into my JQGrid via a Json string and it looks like

"31/10/2011"

I cannot work out the formatting via the JQGrid documentation. I just want it to appear and then be sortable in the grid.

If I post without formatting, the date looks fine but is not recognised as a date, thus the sorting is all wrong.

If I add the following date formatting to the column

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

I am getting a date back that looks like this

03/10/2031

I cannot for the life of me work out what the problem is please help.

Anuj Balan
  • 7,629
  • 23
  • 58
  • 92
Deviland
  • 3,324
  • 7
  • 32
  • 53

1 Answers1

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

sorted the problem

Deviland
  • 3,324
  • 7
  • 32
  • 53
  • 3
    default format of input data is [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) like `2011-10-31` or `2011-10-31T00:00Z`. If you can make changes on the server side I would recommend you to change the format which produce your server. – Oleg May 16 '12 at 14:05
  • @Oleg thanks for your suggestion but I am using the format as stated for a specific reason, and feel that the solution above is more cost effective when it comes to my time than changing the server side code. Thanks for your reply. – Deviland May 17 '12 at 07:49