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.

function renderDate(value){
    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'}

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1. Contact Blog Owner