mysql无法使用内置函数sec_to_time

mysql 5.1.0版本,使用sec_to_time报错:No matching function with signature: sec_to_time
但可以使用time_to_sec,如何才能用呢

img

5.1.0版本 应该不支持吧, 我这 5.5.38 是支持的

img

img

呢可以自定义函数,模拟SEC_TO_TIME的功能

或者这样也可以


SELECT CONCAT(FLOOR(seconds / 3600), ':', LPAD(FLOOR((seconds % 3600) / 60), 2, '0'), ':', LPAD(seconds % 60, 2, '0')) AS time_format
FROM your_table;