in reply to Sorting Dates Issue
The could you posted definitely did not produce the output you said it did. It doesn't even run. If you fix the errors that must be fixed simply to get your code to run (use strict, undeclared $c, undeclared $d), it works fine. Please post code you actually ran!! The code you posted is so far from what you really have, there's no way of telling what your problem is.