2
/Date(1352658600000)/ 

When Display the date Date is not Display in Proper Format.

How to convert in to proper Format(dd/mm/yyyy)?

Narendra Jadhav
  • 9,619
  • 15
  • 29
  • 41
user1856641
  • 21
  • 1
  • 3

2 Answers2

6

All you need to make the conversion is setting date formatter in jqGrid colum model:

$('#gridId').jqGrid({
    ...
    colModel: [
        ...
        { name: 'Column Name', index: 'Column Index', ..., formatter: "date", formatoptions: { newformat: "m/d/Y"} },
        ...
    ],
    ...
});

For the newformat option jqGrid supports PHP date formatting.

tpeczek
  • 23,447
  • 3
  • 72
  • 76
1

Taken from the accepted answer here - Converting json results to a date

You need to extract the number from the string, and pass it into the Date constructor:

var x = [ {"id":1,"start":"\/Date(1238540400000)\/"}, {"id":2,"start":"\/Date(1238626800000)\/"} ];

var myDate = new Date(x[0].start.match(/\d+/)[0] * 1));

The parts are:

x[0].start                                - get the string from the JSON
x[0].start.match(/\d+/)[0]                - extract the numeric part
x[0].start.match(/\d+/)[0] * 1            - convert it to a numeric type
new Date(x[0].start.match(/\d+/)[0] * 1)) - Create a date object
Community
  • 1
  • 1
SimonGates
  • 5,773
  • 4
  • 36
  • 51