Convert these integers into time

  • I have a range of integer values, examples of which look like this;

    151157

    1000

    63020

    214723

    I need to translate these into

    15:11:57

    01:00:00

    06:30:20

    21:47:23

    Does anyone know the most efficient way of doing this?

    Thanks in advance

  • Have you made a typo ?

    1000 = 01:00:00 should that be 10000 ?



    Clear Sky SQL
    My Blog[/url]

  • declare @t integer

    Select @t = 10000

    Select @t = 151157

    Select floor(@T/10000),floor(@T%10000/100.000),@T%100



    Clear Sky SQL
    My Blog[/url]

  • No, it's not a typo but I am wondering if it should be 01:00:00. This is my main issue - there are no leading zeros and I cannot find out exactly what these times should be.

    I also have values of 301, 400...

  • Im afraid no one here will be able to tell you if

    1000 = 01:00:00 or 00:10:00.

    For you sake , i hope it should be 00:10:00.



    Clear Sky SQL
    My Blog[/url]

  • I know! I've just had a look at the distinct values and I believe that is what it is - 00:10:00.

    Thanks for your help.

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

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