Skip to content

Returns the difference between two datetimes in the specified unit.

func.timestampdiff(<unit>, <start>, <end>)
func.timestampdiff('DAY', '2024-01-01', '2024-03-01')
┌────┐
60
└────┘
TIMESTAMPDIFF(<unit>, <start>, <end>)
SELECT TIMESTAMPDIFF(DAY, '2024-01-01', '2024-03-01');
┌────┐
60
└────┘