Convert Numeric Value to Time

  • Hi all,

    I have an application that stores time as a numeric value, for example the value 47965 is stored in the database and the application displays the time as 13:16:25. So the numeric value is obviously representing the number of seconds.

    Is there a function in SQL to covert this numeric value to a time?

    Thanks

  • David (7/16/2008)


    Hi all,

    I have an application that stores time as a numeric value, for example the value 47965 is stored in the database and the application displays the time as 13:16:25. So the numeric value is obviously representing the number of seconds.

    Is there a function in SQL to covert this numeric value to a time?

    Thanks

    You can use DATEADD, e.g. if your start date is 01/01/2000 then if you store the number of seconds in @sec:

    select DATEADD (ss , @sec, '01/01/2000')

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Perfect. Thank you very much.

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

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