August 11, 2011 at 9:21 am
Add % (3600 * 24). That will wipe out anything above 24 hours. This must be applied when the data is in seconds.
August 11, 2011 at 9:22 am
This is a presentation layer task, not a database task. What you should do is output the seconds to the presentation layer and format it there.
That being said, try this: -
DECLARE @seconds INT
SET @seconds = 90000
SELECT CONVERT(VARCHAR(6), @seconds/3600) + ':' + RIGHT('0' + CONVERT(VARCHAR(2), (@seconds % 3600) / 60), 2)
+ ':' + RIGHT('0' + CONVERT(VARCHAR(2), @seconds % 60), 2)
--Edit--
Out of curiosity Remi, how many arms do you have? I figure you must have at least 8 to keep up with your workload 😛
August 11, 2011 at 9:29 am
It's called touch-typing.
You might try it someday :hehe:.
P.S. Totally agree that this should be done at the presentation layer. Just getting tired of saying that ;-).
August 11, 2011 at 9:36 am
skcadavre (8/11/2011)
This is a presentation layer task, not a database task. What you should do is output the seconds to the presentation layer and format it there.
It is said then !
thought there could be a 'clean' way to this
Thanks for the support
August 11, 2011 at 9:37 am
Ninja's_RGR'us (8/11/2011)
It's called touch-typing.You might try it someday :hehe:.
P.S. Totally agree that this should be done at the presentation layer. Just getting tired of saying that ;-).
lol, touch typing? Does that have intellisense? 😛
August 11, 2011 at 9:39 am
ariel_mlk (8/11/2011)
skcadavre (8/11/2011)
This is a presentation layer task, not a database task. What you should do is output the seconds to the presentation layer and format it there.It is said then !
thought there could be a 'clean' way to this
Thanks for the support
Generally, it's better to do formatting in the presentation layer. It can be done in T-SQL, as Remi and I suggested.
August 11, 2011 at 9:41 am
ariel_mlk (8/11/2011)
skcadavre (8/11/2011)
This is a presentation layer task, not a database task. What you should do is output the seconds to the presentation layer and format it there.It is said then !
thought there could be a 'clean' way to this
Thanks for the support
Yes format function in .net if very effective at this. Makes it extremelly clean to t-sql. 😀
Viewing 7 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply