SQL Function Reference

TIMEDIFF
Returns the time difference (datetime1 - datetime2) between DATETIME or TIME values. The result is returned in the format HH:MM:SS.
MySQL
TIMEDIFF(datetime1, datetime2)
Returns NULL if one of the passed values is NULL or both values have a different type.
Examples
MySQL
SELECT TIMEDIFF('2022-12-05 18:00:00','2022-12-05 14:00:00')
MySQL
SELECT TIMEDIFF('2022-12-05 18:00:00','2021-12-01 14:00:00')
MySQL
SELECT TIMEDIFF('2022-12-05 14:00:00','2022-12-05 18:00:00')
MySQL
SELECT TIMEDIFF('18:00:00','14:00:00')
MySQL
SELECT TIMEDIFF('18:00:00','2022-12-05 14:00:00')