JQgrid json date format

2020-07-10 11:15发布

问题:

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.

回答1:

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

sorted the problem