I would like to calculate the difference between a past datetime and the current datetime with the result in [hh]:mm
format.
SQL Server – Calculate Time Difference Between Datetime and Current Date & Time
date formatdatetimesql serversql-server-2008
Related Question
- SQL Server 2008 – How to Convert Date and Time
- MySQL Datetime – Calculating Time Difference
- Sql-server – Find Difference In Time
- SQL Server – How to Get First and Last Record for Each Date and Calculate Their Difference
- SQL Server – Calculating and Showing DATETIME Difference in PIVOT Query
- How to Calculate Total Distance by Datetime in MySQL
- SQL Server – Calculate Difference Between Current and Next Value Without CTE
Best Answer
Try this:
Here's what it does:
GETDATE()
)hh:mm:ss
hh:mm
Oh, and you can
REPLACE
the text "00:" with "" (nothing) if you want to hide the hour if it's less than 60 minutes: