JQgrid json date format
Asked Answered
L

1

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.

Longlived answered 16/5, 2012 at 13:26 Comment(0)
L
10
formatter: 'date', formatoptions: { srcformat: 'd/m/Y', newformat: 'd/m/Y'}

sorted the problem

Longlived answered 16/5, 2012 at 13:54 Comment(2)
default format of input data is 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.Yseulta
@Yseulta 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.Longlived

© 2022 - 2024 — McMap. All rights reserved.