Date display required: d/m/y
How to sort in date order when clicking column order?
I have tried
$qry="select FROM_UNIXTIME(confirm_sent,'%d/%m/%y %a %H:%i') as confirm_sent_al , confirm_sent …."
$col["name"] = "confirm_sent_al";
$col["dbname"] = "confirm_sent";
2 Answers
When you format date using sql function, it will be treated as string and sorted as string.
Perhaps, you are facing issue of sorting days first, month and then year.
If this is the issue, you can try changing it to
…. FROM_UNIXTIME(confirm_sent,'%Y-%m-%d %H:%i:%s') ….
And apply date formatting in grid settings: e.g.
$col["formatoptions"] = array("srcformat"=>'Y-m-d H:i:s',"newformat"=>'d/m/Y H:i');
Your Answer