0

how to do this right

Select DATE_FORMAT(EventDate, '%b %d, %Y') from details Order by STR_TO_DATE(EventDate, '%d-%m-%y')





Oct 24, 2012
Oct 27, 2012
Oct 28, 2012
Oct 20, 2012
Dec 22, 2012    
Jan 11, 2013    
Jan 19, 2013
Nov 24, 2012
Dec 29, 2012
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by dcdruck
0

What do the values of EventDate look like before you do STR_TO_DATE()? Maybe you can post the output of Select EventDate, DATE_FORMAT(EventDate, '%b %d, %Y') from details Order by STR_TO_DATE(EventDate, '%d-%m-%y') so that we can see the real value and the computed value side-by-side.

Just an aside, but do you really mean to sort EventDate by day, then month, then year? Typically it would be by year, then month, then day if you want them in chronological order.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.