Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
drop function if exists my_sec_to_time; delimiter $$ create function my_sec_to_time(inp_s int) returns varchar(25) deterministic begin declare h int; declare m int; declare s int; set s = inp_s - (h * 3600); set h = floor(inp_s / 3600); set m = floor(s / 60); set s = s - (m * 60); return concat(h, ':', m, ':', s); end $$ delimiter ; select my_sec_to_time(123456);

Stuck with a problem? Got Error? Ask AI support!

Copy Clear