chrischen Posted February 19, 2008 Share Posted February 19, 2008 I have a mysql date column that has date stored as mm/dd/yyyy. Is there a way I can have mysql sort this format in a query by date? Link to comment https://forums.phpfreaks.com/topic/91837-sort-by-date/ Share on other sites More sharing options...
aschk Posted February 19, 2008 Share Posted February 19, 2008 Are you sure your column datatype is DATE? Because that mm/dd/yyyy is NOT the default format for MySQL. If it IS a DATE datatype column AND you've changed the default format of dates in your MySQL, then just do ORDER BY `<date column name here>` Link to comment https://forums.phpfreaks.com/topic/91837-sort-by-date/#findComment-470368 Share on other sites More sharing options...
chrischen Posted February 19, 2008 Author Share Posted February 19, 2008 Well the data is provided to me in that format and I was wondering if I can just sort that without having to convert them all. Link to comment https://forums.phpfreaks.com/topic/91837-sort-by-date/#findComment-470688 Share on other sites More sharing options...
fenway Posted February 19, 2008 Share Posted February 19, 2008 Oh, you should defintely convert them all... STR_TO_DATE() makes it easy. Link to comment https://forums.phpfreaks.com/topic/91837-sort-by-date/#findComment-470690 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.