The TIMEDIFF function returns the time difference between the two specified time arguments.
You can enter a date/time type, the TIME, DATE, TIMESTAMP, or DATETIME type and the data types of the two arguments must be identical. The TIME will be returned and the time difference between the two arguments must be in the range of 00:00:00 -23:59:59. If it exceeds the range, an error will be returned.
TIMEDIFF(expr1, expr2)
SELECT TIMEDIFF(time '17:18:19', time '12:05:52');
timediff(time '17:18:19', time '12:05:52')
=============================================
05:12:27 AM
SELECT TIMEDIFF('17:18:19','12:05:52');
timediff('17:18:19', '12:05:52')
===================================
05:12:27 AM
SELECT TIMEDIFF('2010-01-01 06:53:45', '2010-01-01 03:04:05');
timediff('2010-01-01 06:53:45', '2010-01-01 03:04:05')
=========================================================
03:49:40 AM
SELECT TIMEDIFF('2010-01-02 06:53:45', '2010-01-01 03:04:05');
ERROR: ERROR: Conversion error in time format.