SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
drop function if exists my_sec_to_time; delimiter $$ create function my_sec_to_time(inp_s int) returns varchar(10) deterministic begin declare h int; declare m int; declare s int; set s = inp_s % 86400; set h = floor(s / 3600); set s = s % 3600 set m = floor(s / 60); set s = s % 60; return concat(h, ':', m, ':', s); end $$ delimiter ; select my_sec_to_time(123456);
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear