PDA

View Full Version : Date Renderer giving different date from the input date



gokulpotluri
26 Jun 2013, 9:07 PM
Hi,

I am using grid in extjs 3.4 and there is a column with date in the grid.
now i want to change the date format before displaying it in the grid.
For this i am using following two ways of code

asm_profile_date_format = 'F j, Y'



column = new Ext.grid.Column
(
{
header : map['label'],
sortable : true,
dataIndex : map['name'],
renderer : Ext.util.Format.dateRenderer(asm_profile_date_format)
}
)


and



renderer : function(value)
{
if(value == null)
return ' '
else
{
return value.format(asm_profile_date_format);
}
}


Here the value/input date i am getting is 19/6/2013, but the date after the renderer i am getting is jul 6, 2014.

gokulpotluri
27 Jun 2013, 5:28 AM
Before formatting the date first we parsed the date to our required format using parseDate(date, format) and then we formatted that parsed date. now it is giving correct output which we want.