MySql TIMEDIFF做计算之后,后台报Illegal hour value '24' for java.sql.Time type 问题

页面需要显示这种格式:31:01:20

但是后台Springboot会提示Illegal hour value '24' for java.sql.Time type in value '24:00:00.。就是说这玩意不能超过24小时。必须将其转换为字符。

用很多人推荐的方法:DATE_FORMAT(time,'%Y-%c-%d %h:%i:%s') ,转化之后就尴尬了,之间变成7:01:20,默认减去24小时。此方法行不通

https://bugs.mysql.com/bug.php?id=36051

官方网站找到解决办法。利用concat('',time)直接转化成String类型就解决了

to solve this issue try (select concat('',call_duration) from time_table) the concat will make it string so you can process it as string...
原文地址:https://www.cnblogs.com/pangjing/p/10106990.html