scalar

DATEDIFF

T-SQL counts datepart boundaries crossed, not complete elapsed units. Example target: SQL Server (T-SQL). No tables or extensions required.

Formal Syntax & Structure

sql syntaxsql
DATEDIFF(datepart,startdate,enddate)

Working Example

Example Snippetsql
SELECT DATEDIFF(day, '2024-02-28T23:59:00', '2024-02-29T00:01:00');
SQL Reference