SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABE test (dt DATETIME) SELECT '2024-09-09 13:00:00' dt UNION ALL -- will be 2024-09-09 13:05:00 SELECT '2024-09-09 13:00:50' UNION ALL -- will be 2024-09-09 13:05:00 SELECT '2024-09-09 13:01:00' UNION ALL -- will be 2024-09-09 13:05:00 SELECT '2024-09-09 13:04:00' UNION ALL -- will be 2024-09-09 13:05:00 SELECT '2024-09-09 13:04:59' UNION ALL -- will be 2024-09-09 13:05:00 SELECT '2024-09-09 13:05:00' -- will be 2024-09-09 13:10:00 ; SELECT dt, FROM_UNIXTIME((UNIX_TIMESTAMP(dt) + 300) DIV 300) * 300 rounded FROM test;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear