I am trying to display the following dates in order from smallest to biggest.
They are stored this way.
02-12-15 02-11-13 12-20-12 12-12-12 05-12-17
This is the following code I use
"SELECT ledate FROM `points_bar` WHERE student_id = '$studentID' ORDER BY ledate ASC";
And this is what I want to transform it to.
02-11-13 12-20-12 12-12-12 02-12-15 05-12-17
Can someone please point out to me a possible solution or give me a little push?
Your dates are not in mysql supported date format. It treat as varchar. Change the SQL as follows should work.
"SELECT ledate FROM `points_bar` WHERE student_id = '$studentID' ORDER BY STR_TO_DATE(`ledate`, '%m-%d-%y') ASC";