SELECT DATEDIFF(hh,GETDATE()-1,GETDATE()) AS DateDifference
SELECT DATEDIFF(day,'2013-02-07',GETDATE()) AS DateDifference
SELECT DATEDIFF(ww,'2013-02-07',GETDATE()) AS DateDifference
datediff() function in SQL Server to get date difference in days hours minutes, years, month between two dates or calculate datediff in SQL Server in days hours minutes format.
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegisterMembers onlyeBook · SQL ServerBasics of SQL ServerDownload nowWrite a blog post and earn +250 SHARP when it is approved.
Write a blog
Join the conversation! Your thoughts help the community grow.