Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Convert seconds to a timestring Expand / Collapse
Author
Message
Posted Thursday, April 29, 2010 2:39 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 8:27 AM
Points: 925, Visits: 1,094
Comments posted to this topic are about the item Convert seconds to a timestring

Wilfred
The best things in life are the simple things
Post #913275
Posted Wednesday, May 05, 2010 8:31 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:47 AM
Points: 1,174, Visits: 2,635
An alternative, using DATEADD and CONVERT

select CONVERT (varchar(8),DATEADD(second,@duration,0),114)



--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

Post #916122
Posted Wednesday, May 05, 2010 9:06 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 8:27 AM
Points: 925, Visits: 1,094
WOW! that was an easy one! Sometimes you're working on a solution which can be replaced by a very few lines ( I feel stupid )
Have a drink from me!


Wilfred
The best things in life are the simple things
Post #916171
Posted Wednesday, May 05, 2010 1:04 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, April 13, 2014 6:24 PM
Points: 45, Visits: 325
Keep in mind that this only works up to 23:59:59. Anything greater than or equal to 24 hours (86,400 seconds) will not work. I have reports were we show some records with more than 24 hours and had to write a custom function.
Post #916383
Posted Thursday, May 06, 2010 2:30 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:47 AM
Points: 1,174, Visits: 2,635
robshobs (5/5/2010)
Keep in mind that this only works up to 23:59:59. Anything greater than or equal to 24 hours (86,400 seconds) will not work. I have reports were we show some records with more than 24 hours and had to write a custom function.


Excellent point, thanks.


--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

Post #916725
Posted Thursday, May 06, 2010 2:33 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:47 AM
Points: 1,174, Visits: 2,635
Wilfred van Dijk (5/5/2010)
WOW! that was an easy one! Sometimes you're working on a solution which can be replaced by a very few lines ( I feel stupid )
Have a drink from me!


Thanks for the feedback, glad to have contributed something useful.

Now, about that drink ...


--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

Post #916727
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse