Using SQL Server 2005
Table1
ID Intime Outtime
001 00.21.00 00.48.00
002 08.23.00 13.45.00
003 00.34.00 00.18.00
I need to display the time time like 30 minutes or 1 Hours, it should display a roundoff time
Expected Output
ID Intime Outtime
001 00.30.00 01.00.00
002 08.30.00 14.00.00
003 01.00.00 00.30.00
How to make a query for the roundoff time.
You can round the current date to 30 minutes like:
Explanation: this takes the number of minutes since the 0-date:
Then it rounds that to a multiple of 30 by dividing and multiplying by 30:
The result is added back to the 0-date to find the last 30 minute block
This can be adjusted easily for 60 minutes. 🙂