SELECT *,CAST(Datediff(HOUR, 0, logout_time - login_time) + Cast(Datediff(MINUTE, 0, logout_time - login_time) - (Datediff(HOUR, 0, logout_time - login_time) * 60 ) AS DECIMAL) / 100 AS Decimal(18,2)) AS [TotalHrs_Worked] FROM table_DTR WHERE CONVERT(VARCHAR(10),log_date, 101) BETWEEN '09/01/2014' AND '11/30/2014'
Declare @date1 Datetime='Dec 15 2014 08:00 AM' Declare @date2 Datetime='Dec 15 2014 06:30 PM' select DATEDIFF(MINUTE,@date1,@date2)/60.0
SELECT *, CAST(DATEDIFF(minute, login_time, logout_time) AS DECIMAL) / 60 AS Worked FROM MyTable
SELECT *,CAST((Datediff(MINUTE,login_time,logout_time)/60) as decimal(18,2)) AS [TotalHrs_Worked] FROM table_DTR WHERE CONVERT(VARCHAR(10),log_date, 101) BETWEEN '09/01/2014' AND '11/30/2014'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)