The DATE_FORMAT() function is used to display date/time data in different formats. DATE_FORMAT(NOW(),'%m-%d-%Y').
The SUBSTRING_INDEX() function is used to return the delimiter DELIM that appears before the count of the substring str.
SELECT appointment_time,DATE_FORMAT(appointment_time,'%Y%m%d')AS appointment_time2 , d_time,(SUBSTRING_INDEX(d_time, ':', 1) + 0) AS d_time2 FROM yuyuexitong.tb_patient ORDER BY appointment_time DESC, d_time DESC LIMIT 0, 50;
Effect picture: