mysql time intercepts the year, month and day and intercepts the preceding characters by colon

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:

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326974968&siteId=291194637