Re: time conversions

William Salame ( )
Thu, 06 Aug 1998 19:08:29 +1000

We use somthing like this

durationh = FLOOR(AcctSessionTime/3600),
durationm = FLOOR(AcctSessionTime/60) - 60*FLOOR(AcctSessionTime/3600),
durations = CONVERT(INT,AcctSessionTime) - 60*FLOOR(AcctSessionTime/60),

Then we display <%durationh%> : <%durationm%> : <%durations%>

Josh Hillman wrote:

> Is there a way to take an integer like 8625 (representing seconds) and
> convert it into something like "2:23:45" using SQL? If at all possible,
> I'd like to use this in one of my scripts to show the integer
> AcctSessionTime as hours:minutes:seconds (VarChar, I guess). If
> AcctSessionTime were some form of Date/Time it would be easy using
> CONVERT(whatever), but realistically, it makes sense that it's an integer.
> Josh Hillman