how to convert decimal time to hours and min
HI i am creating a SSRS Report in that report i need get calculate the total hours spent (its column name) . in database that time is declared as Decimal . if i try to add total hours it is calculating like this( if current time is 2hr 40 min , if i add another 0 min it is taking as 2 hr 80 min instead of this i want 3 hr 20 min . how can i do that in SSRS . is der any formule for this Thanks
August 16th, 2011 7:37am

CREATE TABLE t1 (t DECIMAL(5,2)) INSERT INTO t1 VALUES (2.40) INSERT INTO t1 VALUES (3.30) DECLARE @h INT SET @h=40 SELECT t,CONVERT(CHAR(5),t1,114) FROM ( SELECT *, DATEADD(MINUTE, CAST(t AS INT)*60+RIGHT(t,CHARINDEX('.',REVERSE(t))-1)+@h, DATEADD(DAY, DATEDIFF(DAY, '20010101', '20090101'), '20010101')) AS t1 FROM t1 ) AS DERBest Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
August 16th, 2011 8:02am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics