Home > Software design >  how safely SUM TIME fields where the sum will likely overflow the 35 days limit?
how safely SUM TIME fields where the sum will likely overflow the 35 days limit?

Time:01-22

Mysql TIME type as a maximum of 35 days

TIME values may range from '-838:59:59' to '838:59:59'

The same limit applies to the result of SEC_TO_TIME.

So how can I safely SUM TIME type fields in contexts where the sum will likely overflow the 35 days limit?

CodePudding user response:

I don't know why you may need summarize times. But you always can convert it to seconds and summarize seconds as longint.

select sum(TIME_TO_SEC(time_column)) as sumtime from table
  • Related