How can I display date/time in grid panel. The date is coming from server side asp.net web service as:
{9/14/2009 10:23:00 AM}
I am getting an error in displaying the date and time. It shows NaN/NaN/NaN 12:NaN:NaN PM
var store = new FMP.AspNetJsonStore({
fields: [
{ name: 'DateOccurred'}
],
});
var dateRenderer = Ext.util.Format.dateRenderer('m/d/Y h:i:s A');
{ header: xppo.st('SDE_DATE_OCCURRED'), width: 75, sortable: true,
dataIndex: 'DateOccurred', renderer: dateRenderer },
In the store if I define fields:
[ { name: 'DateOccurred', type: 'date', dateFormat: 'm/d/Y'} ],
... it displays a blank field.
Please help me in this issue.
The specified dateFormat must match the date string exactly for it to parse. The format 'm/d/Y' fails because it is missing the time component and 'm' expects a 2 digit month. A dateFormat which successfully parses your example date string is:
'n/d/Y H:i:s A'
You can also try omitting dateFormat while leaving the field's type set to 'date'. In absence of a specific format ExtJS will fall back on Date.parse.
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