Skip to content

Instantly share code, notes, and snippets.

View rodrigozem's full-sized avatar
🎯
Focusing

Rodrigo rodrigozem

🎯
Focusing
View GitHub Profile
@NaWer
NaWer / BIG_SEC_TO_TIME.sql
Last active February 8, 2023 08:49
SEC_TO_TIME and TIME_TO_SEC is constrained to the range of the TIME data type (-838:59:59 to 838:59:59). This MySQL function overtakes this limit.
DROP FUNCTION IF EXISTS BIG_SEC_TO_TIME;
DELIMITER $$
CREATE FUNCTION BIG_SEC_TO_TIME(SECS BIGINT)
RETURNS TEXT
READS SQL DATA
DETERMINISTIC
BEGIN
DECLARE HEURES TEXT;
DECLARE MINUTES CHAR(5);
DECLARE SECONDES CHAR(5);