TIMESTAMPDIFF()
It returns the difference between two date/time values in the specified unit (like SECOND, MINUTE, DAY) as the output.
Syntax:
TIMESTAMPDIFF(unit, datetime1, datetime2)
Example:
SELECT TIMESTAMPDIFF(DAY, '2025-04-01', '2025-04-17') AS DaysDiff;
Output:
16
