I have a problem with the jqgrid Date formatter.
in my DB table i have this dateformat “Ymd” like “20120219”.
Here the whole code for this column:
$col = array();
$col["title"] = "Date";
$col["name"] = "date_dem";
$col["width"] = "40";
$col["editable"] = false;
$col["editoptions"] = array("size"=>20);
$col["formatter"] = "date"; // format as date
$col["formatoptions"] = array("srcformat"=>'Ymd',"newformat"=>'d/m/Y');
$cols[] = $col;
When i use this code i get for every record the same output: “01/01/1970”.
Anybody knows this problem?
THX in advanced
Even if the information about the date are saved as
Ymdwithout any separators you have to return from the server the information with some separator between year, month and day. The problem is that the current code of jqGrid first split the input date using'\','/',':','_',';','.'or','as separator (see the line of code)and then use the
srcformatto decode it. So you can’t useformatter: "date"to decode the date like20121009. I recommend you to convert20121009to2012-10-09on the server side and return from the server the date always in ISO 8601 format which is defalt format used by jqGrid. Alternatively you can use custom formatter to display the date.