tags:

views:

1825

answers:

1

Ho w 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} Iam 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 give fields: [ { name: 'DateOccurred', type: 'date', dateFormat: 'm/d/Y'} ],

it displays a blank field.

Please help me in this issue.

+1  A: 

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.

owlness
thanks for the reply.i have changed my datetime object to a string as i had some other issues parsing it.
xrx215