24 March 2018

Sorting Date Column in Flexgrid+PHP

If youre using php and flexgrid, one of its flaw is sorting the date column

Solution is within mysql query, convert the column as string with yyyy-mm-dd format, and cast it to char type, because using date_format only will not work

Sample for one of date column in my query :

cast(DATE_FORMAT(`ShipDate`,'%Y-%m-%d') AS char) as ShipDate

Hope this help

No comments:

Post a Comment