Dates and Times in SQL Server: DATEDIFF() and DATEDIFF_BIG()
Last time we looked at adding or subtracting date parts using the DATEADD() T-SQL system function. This week we see how to calculate the difference between two date-time values using DATEDIFF() and DATEDIFF_BIG(). The syntax for both functions is identical:
1 2 3 4 5 |
DATEDIFF (datepart, startdate, enddate) -- returns a result as an INT DATEDIFF_BIG (datepart, startdate, enddate) -- returns a result as a BIGINT |
The only functional difference between them is that the DATEDIFF_BIG() returns values as a
-> Continue reading Dates and Times in SQL Server: DATEDIFF() and DATEDIFF_BIG()