使用​​DATE_FORMAT​​函数

SELECT
id,
NAME,
DATE_FORMAT( time, '%Y-%m-%d %H:%i:%s' ) as time
FROM
demo
WHERE
time BETWEEN '2021-09-10 10:20:00'
AND '2021-09-10 10:25:00'

SQL:mysql将datetime类型数据格式化_数据库