JavaScript parseDate
When trying to display the proper date, using renderer in ExtJS, from a returned XML document generated by ColdFusion I ran into problems. ColdFusion returns the date from a MS SQL query in a format like this "2008-10-08 14:26:01.0". The standard ExtJS date rendered didn't know how to handle this format so I had to create a custom one.
var dt = new Date();
dt = Date.parseDate(value, "Y-m-d h:i:s.0");
return dt.format('F d, Y');
}
Notice I had to put the ".0" at the end. The result is "Month Day, Year". Otherwise is returns dt as undefined. So the ExtJS data model for that line looks like:
{header: "Date", width: 40, sortable: true, renderer: renderDate, dataIndex: 'date'}


There are no comments for this entry.
[Add Comment]