I have a array of JSON objects each having date as one of the fields.
var array = [{id: 1, date:'Mar 12 2012 10:00:00 AM'},{id: 2, date:'Mar 8 2012 08:00:00 AM'}]
I want to sort the objects in descending order on the basis of the time stamp. I have written a utility for it. i.e.
var sortedData= array .sort((function (a, b) { return new Date(b.date) - new Date(a.date) }));
but the above utility sorts on the basis of only date .i.e mar 12 and mar 8 in above case. It doesn't take into consideration the time factor which is 10.00 AM and 8.00 AM. How the sorting can be done using both the parameters, date as well as time.