Convert seconds to a timestring

  • Wilfred van Dijk

    SSCrazy Eights

    Points: 8906

    Comments posted to this topic are about the item Convert seconds to a timestring

    Wilfred
    The best things in life are the simple things

  • nigel.

    SSChampion

    Points: 11485

    An alternative, using DATEADD and CONVERT

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

    --
    Nigel

  • Wilfred van Dijk

    SSCrazy Eights

    Points: 8906

    WOW! :w00t::w00t: that was an easy one! Sometimes you're working on a solution which can be replaced by a very few lines ( I feel stupid :ermm::ermm::ermm: )

    Have a drink from me!

    Wilfred
    The best things in life are the simple things

  • robshobs

    SSC Eights!

    Points: 961

    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.

  • nigel.

    SSChampion

    Points: 11485

    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

  • nigel.

    SSChampion

    Points: 11485

    Wilfred van Dijk (5/5/2010)


    WOW! :w00t::w00t: that was an easy one! Sometimes you're working on a solution which can be replaced by a very few lines ( I feel stupid :ermm::ermm::ermm: )

    Have a drink from me!

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

    Now, about that drink ... 🙂

    --
    Nigel

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    Thanks for the script.

Viewing 7 posts - 1 through 7 (of 7 total)

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