We know that the range of the TIME field in MySQL is ‘-838:59:59’ to ‘838:59:59’. Now, if the output of the TIMEDIFF() function is outside this range, MySQL will return '-838:59:59' or '838:59:59', depending on the value of the argument.
mysql> Select TIMEDIFF('2017-09-01 03:05:45','2017-10-22 03:05:45')AS 'Out of Range TIME Difference'; +------------------------------+ | Out of Range TIME Difference | +------------------------------+ | -838:59:59 | +------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> Select TIMEDIFF('2017-10-22 04:05:45','2017-09-01 03:05:45')AS 'Out of Range TIME Difference'; +------------------------------+ | Out of Range TIME Difference | +------------------------------+ | 838:59:59 | +------------------------------+ 1 row in set, 1 warning (0.01 sec)
The above query shows that if the total difference exceeds the range, MySQL will return the maximum or minimum limit value of the TIME field range.
The above is the detailed content of What happens if the output of the MySQL TIMEDIFF() function exceeds the range value of the TIME field?. For more information, please follow other related articles on the PHP Chinese website!