Surpassing MySQL's TIME value limit of 838:59:59

前端 未结 6 554
南旧
南旧 2020-12-01 14:54

The title might be a bit confusing so allow me to explain. I\'m using a table to record my work logs. Every day I\'ll create an entry stating from what time to what time I h

6条回答
  •  被撕碎了的回忆
    2020-12-01 15:40

    select  concat(truncate(sum(time_to_sec(TIMEDIFF(hora_fim, hora_ini)))/3600,0), ':', 
    TIME_FORMAT(sec_to_time(sum(time_to_sec(TIMEDIFF(hora_fim, hora_ini))) - truncate(sum(time_to_sec(TIMEDIFF(hora_fim, hora_ini)))/3600,0)*3600), '%i:%s'))
    as hms from  tb_XXXXXX
    

提交回复
热议问题