My application send timestamp data to jqgrid (like "1268913728759").
now i want to format it like dd/mm/yyyy
.
In jqGrid
I added following line but it doesn't worked
{name:'testDate',index:'testDate', width:100, formatter:'date', formatoptions: {srcformat: 'ts',newformat:'d/m/Y'}}
The correct seetings for this case should be like this:
formatter:'date', formatoptions: {srcformat: 'U', newformat:'d/m/Y'}
The 'U' is format character for 'Seconds since the Unix Epoch' date format.
Try this:
formatter: function (cellValue, opts, rwd) {
if (cellValue) {
return $.fn.fmatter.call(this, "date", new Date(cellValue), opts, rwd);
} else {
return '';
}
}
The correct seetings for this case should be like this:
formatter:'date', formatoptions: {srcformat: 'U', newformat:'d/m/Y'}
The 'U' is format character for 'Seconds since the Unix Epoch' date format.
The timestamp like "1268913728759" means milliseconds not seconds since the Unix Epoch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With