DATEDIFF

Calculates the total number of minutes, hours, days, months, or years between two date/times.

Syntax

DATEDIFF(startdate, enddate, unit)

Example

DATEDIFF('2024-04-19', '2024-04-27', 'DD')

returns: 8 (days)

Notes

Unit specifiers are:
YY - whole years
MM - whole months
DD - whole days
HH - whole hours
MI - whole minutes
SS - whole seconds

Related 

DATEADD