February 2, 2006 at 5:58 am
hi,
I have an application that gives all of its times in mins as an integer. I needed to convert this to mins, hrs, days(8hrs) to get some meaningful reports for the Users.
my programming skills are pants , even i can get the hrs by dividing by 60, but is there a function or something from this to give me the remainder so i can work out the mins?
can anyone help please.
February 2, 2006 at 6:25 am
DECLARE @minutes INT
SET @minutes = 200
SELECT @minutes / 60 AS hours
, @minutes % 60 AS minutes
February 2, 2006 at 6:34 am
thanks chris, i had just found the modulo in BOL...
i am trying to add a day into the equation after every 8 hours, is this just as simple?
February 2, 2006 at 8:46 am
More or less...
DECLARE @minutes INT
SET @minutes = 2000
SELECT @minutes / (60 * 8) AS days, @minutes % (60 * 8) / 60 AS hours, @minutes % (60 * 8) % 60 AS minutes
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply