Please help me to do this
decimal 6.80 should equal to 7.20 hours
DECLARE @R1 decimal(4,2);
DECLARE @R2 decimal(4,2);
declare @Type1 decimal(4,2);
declare @Type2 decimal(4,2);
DECLARE @R1Time decimal(4,2);
DECLARE @R2Time decimal(4,2);
SET @R1=2.5
SET @R2=3.5
SET @Type1=17;
SET @Type2=7;
SET @R1Time=(FORMAT((ISNULL(60.0/NULLIF(@R1,0),0)),'N2'))
SET @R2Time=(FORMAT((ISNULL(60.0/NULLIF(@R2,0),0)),'N2'))
SELECT @R1Time as R1Min
SELECT @R2Time as R2Min
SELECT FORMAT(((@Type1*@R1Time)/60.0),'N2') R1Hrs -- 6.80 hours this = 24*17=408/60
SELECT FORMAT(((@Type2*@R2Time)/60.0),'N2') R2Hrs
SELECT CONVERT(CHAR(5), DATEADD(MINUTE, 60*(convert(decimal(4,2),FORMAT(((@Type1*@R1Time)/60.0),'N2'))), 0), 108);--6.48 hours
6.80 hours this = 24*17=408/60 this should be 7.20 hours not 6.48 is it?. Did I am wrong please help me thanks
@R1 is how many in an hour 60/2.5 =24min per Type1 and 17 Type1 is 17*24 =408 min then convert to time –