Yes just after storing date into the array, use sorting of all recordset by Date in ascending / descending order so that it will be arranged as per date and you will get the sorted data.