How do I convert seconds to a smalldatetime?

  • I have a value in seconds as an int that I want to convert into hours minutes and seconds in the format hh:mm:ss. Any ideas on how to do this without writing something to calculate the hours and minutes individually? It has to work on SQL 7 and 2000. Ta very muchly for any help in this as it is Friday, it's late and my brain has stopped working.

  • DECLARE @seconds int

    SET @seconds = 423456

    SELECT CONVERT(char(8),DATEADD(s,@seconds,0),8)



    --Jonathan

  • That works a treat , thanks for that.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply