我們知道MySQL中TIME欄位的範圍是‘-838:59:59’到‘838:59:59’。現在,如果 TIMEDIFF() 函數的輸出超出此範圍,則 MySQL 將傳回 '-838:59:59' 或 '838:59:59',具體取決於參數的值。
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)
上面的查詢表明,如果總差值超出範圍,MySQL 將傳回 TIME 欄位範圍的最大或最小限制值。
以上是如果 MySQL TIMEDIFF() 函數的輸出超出 TIME 欄位的範圍值會發生什麼事?的詳細內容。更多資訊請關注PHP中文網其他相關文章!